题解 | #链表的奇偶重排#

滑动窗口的最大值

http://www.nowcoder.com/practice/1624bc35a45c42c0bc17d17fa0cba788

class Solution:
    def maxInWindows(self, num, size):
        # write code here
        res = []
        length = len(num)
        if size>length or size<1:
            return []
        for i in range(length-size+1):
            max_num = num[i]

            for j in range(size):
                max_num = max(max_num, num[i+j])
            res.append(max_num)

        return res
全部评论

相关推荐

米哈游校招进主页喵:大佬 考虑我司不 考虑的话可以看我主页帖子
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务