485. Max Consecutive Ones Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Solution1: ...
分类:
其他好文 时间:
2017-10-19 19:41:04
阅读次数:
226
1.给定数组[1,1,1,2,2,2,4,5,6,4,2,1] 很多时候,需要针对该数组创建一个给不包含重复元素的新数组。 这时,为了避免占用额外的空间去统计新数组的长度素,我们可以通过求解旧数组中最大值的方法来求解长度。 例如该数组中最大值为6.那新数组的长度则最大为7.即0-6. 当然这个数组可 ...
分类:
编程语言 时间:
2017-10-19 16:02:54
阅读次数:
166
Given an unsorted array of integers, find the length of longest continuous increasing subsequence. Example 1: Example 2: Note: Length of the array wil ...
分类:
其他好文 时间:
2017-10-19 15:56:00
阅读次数:
148
Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t ...
分类:
其他好文 时间:
2017-10-19 15:02:32
阅读次数:
164
class Solution { public int maxProduct(int[] nums) { int res=nums[0]; for(int i=1, imax=res,imin=res;i<nums.length;i++) { int cmax=Math.max(nums[i]*im... ...
分类:
其他好文 时间:
2017-10-18 10:09:29
阅读次数:
123
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: ...
分类:
其他好文 时间:
2017-10-17 17:29:48
阅读次数:
185
Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7390 Accepted Submission(s): 2498 Pro ...
分类:
其他好文 时间:
2017-10-17 12:33:33
阅读次数:
173
Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defi ...
分类:
其他好文 时间:
2017-10-17 12:18:49
阅读次数:
104
Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t ...
分类:
其他好文 时间:
2017-10-16 19:39:41
阅读次数:
142
Given an array of n elements.Find the maximum sum when the array elements will be arranged in such way. Multiply the elements of each pair and add to ...
分类:
其他好文 时间:
2017-10-16 16:55:28
阅读次数:
110