You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a binary tree, find the length of the longest consecutive sequence path.
3
+
4
+
The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The longest consecutive path need to be from parent to child (cannot be the reverse).
5
+
6
+
For example,
7
+
1
8
+
\
9
+
3
10
+
/ \
11
+
2 4
12
+
\
13
+
5
14
+
Longest consecutive sequence path is 3-4-5, so return 3.
15
+
2
16
+
\
17
+
3
18
+
/
19
+
2
20
+
/
21
+
1
22
+
Longest consecutive sequence path is 2-3,not3-2-1, so return 2.
Given a rows x cols screen and a sentence represented by a list of non-empty words, find how many times the given sentence can be fitted on the screen.
3
+
4
+
Note:
5
+
6
+
A word cannot be split into two lines.
7
+
The order of words in the sentence must remain unchanged.
8
+
Two consecutive words in a line must be separated by a single space.
9
+
Total words in the sentence won't exceed 100.
10
+
Length of each word is greater than 0 and won't exceed 10.
11
+
1 ≤ rows, cols ≤ 20,000.
12
+
Example 1:
13
+
14
+
Input:
15
+
rows = 2, cols = 8, sentence = ["hello", "world"]
16
+
17
+
Output:
18
+
1
19
+
20
+
Explanation:
21
+
hello---
22
+
world---
23
+
24
+
The character '-' signifies an empty space on the screen.
25
+
Example 2:
26
+
27
+
Input:
28
+
rows = 3, cols = 6, sentence = ["a", "bcd", "e"]
29
+
30
+
Output:
31
+
2
32
+
33
+
Explanation:
34
+
a-bcd-
35
+
e-a---
36
+
bcd-e-
37
+
38
+
The character '-' signifies an empty space on the screen.
|448|[Find All Numbers Disappeared in an Array](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array)|[Python](./400-500q/448.py)|Easy|
99
99
|442|[Find All Duplicates in an Array](https://leetcode.com/problems/find-all-duplicates-in-an-array)|[Python](./400-500q/442.py)|Easy|
|410|[Split Array Largest Sum](https://leetcode.com/problems/split-array-largest-sum/)|[Python](./400-500Q/410.py)|Hard|
101
102
102
103
@@ -109,6 +110,7 @@ Python solution of problems from [LeetCode](https://leetcode.com/).
109
110
|378|[Kth Smallest Element in a Sorted Matrix](https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix)|[Python](./300-400q/378.py)|Medium|
110
111
|350|[Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/)|[Python](./300-400q/350.py)|Easy|
111
112
|347|[Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/)|[Python](./300-400q/347.py)|Medium|
113
+
|346|[Moving Average from Data Stream](https://leetcode.com/problems/moving-average-from-data-stream)|[Python](./300-400q/346.py)|Easy|
112
114
|340|[Longest Substring with At Most K Distinct Characters](https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters)|[Python](./300-400q/340.py)|Hard|
0 commit comments