摘要: Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2017-10-15 16:52 daniel456 阅读(133) 评论(0) 推荐(0)
摘要: Given an unsorted array of integers, find the length of longest continuous increasing subsequence. Example 1: Example 2: Note: Length of the array wil 阅读全文
posted @ 2017-10-15 16:47 daniel456 阅读(125) 评论(0) 推荐(0)
摘要: Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decr 阅读全文
posted @ 2017-10-15 16:31 daniel456 阅读(152) 评论(0) 推荐(0)
摘要: Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave 阅读全文
posted @ 2017-10-15 11:38 daniel456 阅读(142) 评论(0) 推荐(0)
摘要: Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the 阅读全文
posted @ 2017-10-15 11:13 daniel456 阅读(99) 评论(0) 推荐(0)
摘要: Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: Note: 求三个乘积最大,注意下负数的情况,两负*一正 阅读全文
posted @ 2017-10-15 11:07 daniel456 阅读(96) 评论(0) 推荐(0)
摘要: Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they 阅读全文
posted @ 2017-10-15 11:04 daniel456 阅读(151) 评论(0) 推荐(0)
摘要: Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be 阅读全文
posted @ 2017-10-15 10:46 daniel456 阅读(112) 评论(0) 推荐(0)
摘要: In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data. 阅读全文
posted @ 2017-10-15 09:54 daniel456 阅读(120) 评论(0) 推荐(0)
摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2017-10-15 09:47 daniel456 阅读(87) 评论(0) 推荐(0)