Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two di ...
分类:
其他好文 时间:
2017-09-03 10:10:36
阅读次数:
213
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l ...
分类:
其他好文 时间:
2017-09-03 10:08:39
阅读次数:
133
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-09-03 09:58:25
阅读次数:
169
号称还有O(n)的算法: http://articles.leetcode.com/longest-palindromic-substring-part-ii/ 后面再研究, ...
分类:
其他好文 时间:
2017-09-03 01:12:33
阅读次数:
209
题目: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given [100, 4, 200, 1, 3, 2],The lo ...
分类:
其他好文 时间:
2017-09-02 12:58:21
阅读次数:
165
A common way to uniquely encode a string is by replacing its consecutive repeating characters (or “chunks”) by the number of times the character occur ...
分类:
其他好文 时间:
2017-08-31 16:15:38
阅读次数:
240
class Solution { public int longestConsecutive(int[] nums) { if (nums.length set = new HashSet(); for (int num : nums) { set.add(num); } i... ...
分类:
其他好文 时间:
2017-08-30 14:14:00
阅读次数:
105
题目描述 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farth ...
分类:
其他好文 时间:
2017-08-27 15:19:46
阅读次数:
171
题目大意:给出一个只包含字符'('和')'的字符串S,求最长有效括号序列的长度。 很有趣的题目,有助于我们对这种人类自身制定的规则的深入理解,可能我们大多数人都从没有真正理解过怎样一个括号序列是有效的,因此解题也无从说起。整道题目的难度在于我们对有效括号序列的理解和定义。下面给出我自己的定义:、 定 ...
分类:
其他好文 时间:
2017-08-26 22:14:16
阅读次数:
249
题目: anysubsequence of the other strings. A subsequence is a sequence that can be derived from one sequence by deleting some characters without changin ...
分类:
其他好文 时间:
2017-08-26 11:25:51
阅读次数:
173