摘要: 问题: 给出给定数组的描述: Example 1: Input: [0,1,2,4,5,7] Output: ["0->2","4->5","7"] Explanation: 0,1,2 form a continuous range; 4,5 form a continuous range. Ex 阅读全文
posted @ 2020-03-15 14:41 habibah_chang 阅读(116) 评论(0) 推荐(0)
摘要: 问题:给定数组中,能否最多修改一个数,使得数组成为非减数组,即对数组中任意相邻两数:nums[i] <= nums[i+1] Example 1: Input: [4,2,3] Output: True Explanation: You could modify the first 4 to 1 t 阅读全文
posted @ 2020-03-15 14:09 habibah_chang 阅读(146) 评论(0) 推荐(0)
摘要: 问题: 处理给定数组,(平滑处理)使得每个元素=周围+自己共9个元素的平均值。(若没有9个元素,则是周围一圈+自己元素的平均值) Input: [[1,1,1], [1,0,1], [1,1,1]] Output: [[0, 0, 0], [0, 0, 0], [0, 0, 0]] Explanat 阅读全文
posted @ 2020-03-15 13:38 habibah_chang 阅读(98) 评论(0) 推荐(0)
摘要: 问题: 求给定数组中,连续k个数的最大平均值。 Input: [1,12,-5,-6,50,3], k = 4 Output: 12.75 Explanation: Maximum average is (12-5-6+50)/4 = 51/4 = 12.75 Note: 1 <= k <= n < 阅读全文
posted @ 2020-03-15 12:18 habibah_chang 阅读(108) 评论(0) 推荐(0)
摘要: 问题:求一个数列里三个数相乘的最大值 Input: [1,2,3] Output: 6 Input: [1,2,3,4] Output: 24 Note: 1.The length of the given array will be in range [3,104] and all element 阅读全文
posted @ 2020-03-15 12:08 habibah_chang 阅读(134) 评论(0) 推荐(0)
摘要: 问题: 种花问题,在给出的花圃中(可能已经种植了一些花),如果存在空位与其他花相隔1个空位,则可在此处种植。 求:给出的花圃中,能否种植完给定数量的花。 Input: flowerbed = [1,0,0,0,1], n = 1 Output: True Input: flowerbed = [1, 阅读全文
posted @ 2020-03-15 11:45 habibah_chang 阅读(128) 评论(0) 推荐(0)