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
Copy file name to clipboardExpand all lines: problems/managers-with-at-least-5-direct-reports/README.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,8 +26,7 @@
26
26
+------+----------+-----------+----------+
27
27
</pre>
28
28
29
-
<p>Given the <code>Employee</code> table, write a SQL query that finds out managers with at least 5 direct report. For the above table, your SQL query should return:
30
-
</p>
29
+
<p>Given the <code>Employee</code> table, write a SQL query that finds out managers with at least 5 direct report. For the above table, your SQL query should return:</p>
Copy file name to clipboardExpand all lines: problems/maximum-average-subarray-i/README.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,24 +11,26 @@
11
11
12
12
## 643. Maximum Average Subarray I (Easy)
13
13
14
-
<p>
15
-
Given an array consisting of <code>n</code> integers, find the contiguous subarray of given length <code>k</code> that has the maximum average value. And you need to output the maximum average value.
16
-
</p>
14
+
<p>Given an array consisting of <code>n</code> integers, find the contiguous subarray of given length <code>k</code> that has the maximum average value. And you need to output the maximum average value.</p>
15
+
16
+
<p><b>Example 1:</b></p>
17
17
18
-
<p><b>Example 1:</b><br />
19
18
<pre>
20
19
<b>Input:</b> [1,12,-5,-6,50,3], k = 4
21
20
<b>Output:</b> 12.75
22
21
<b>Explanation:</b> Maximum average is (12-5-6+50)/4 = 51/4 = 12.75
Copy file name to clipboardExpand all lines: problems/maximum-width-of-binary-tree/README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,12 @@
11
11
12
12
## 662. Maximum Width of Binary Tree (Medium)
13
13
14
-
<p>Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binary tree has the same structure as a <b>full binary tree</b>, but some nodes are null.</p>
14
+
<p>Given a binary tree, write a function to get the maximum width of the given tree. The width of a tree is the maximum width among all levels. The binary tree has the same structure as a <b>full binary tree</b>, but some nodes are null.</p>
15
15
16
16
<p>The width of one level is defined as the length between the end-nodes (the leftmost and right most non-null nodes in the level, where the <code>null</code> nodes between the end-nodes are also counted into the length calculation.</p>
17
17
18
-
<p><b>Example 1:</b><br />
18
+
<p><b>Example 1:</b></p>
19
+
19
20
<pre>
20
21
<b>Input:</b>
21
22
@@ -29,8 +30,8 @@
29
30
<b>Explanation:</b> The maximum width existing in the third level with the length 4 (5,3,null,9).
30
31
</pre>
31
32
33
+
<p><b>Example 2:</b></p>
32
34
33
-
<p><b>Example 2:</b><br />
34
35
<pre>
35
36
<b>Input:</b>
36
37
@@ -44,8 +45,8 @@
44
45
<b>Explanation:</b> The maximum width existing in the third level with the length 2 (5,3).
45
46
</pre>
46
47
48
+
<p><b>Example 3:</b></p>
47
49
48
-
<p><b>Example 3:</b><br />
49
50
<pre>
50
51
<b>Input:</b>
51
52
@@ -59,7 +60,8 @@
59
60
<b>Explanation:</b> The maximum width existing in the second level with the length 2 (3,2).
60
61
</pre>
61
62
62
-
<p><b>Example 4:</b><br />
63
+
<p><b>Example 4:</b></p>
64
+
63
65
<pre>
64
66
<b>Input:</b>
65
67
@@ -76,9 +78,7 @@
76
78
77
79
</pre>
78
80
79
-
<p><b>Note:</b>
80
-
Answer will in the range of 32-bit signed integer.
81
-
</p>
81
+
<p><b>Note:</b> Answer will in the range of 32-bit signed integer.</p>
Copy file name to clipboardExpand all lines: problems/my-calendar-i/README.md
+22-21Lines changed: 22 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,36 +11,37 @@
11
11
12
12
## 729. My Calendar I (Medium)
13
13
14
-
<p>
15
-
Implement a <code>MyCalendar</code> class to store your events. A new event can be added if adding the event will not cause a double booking.
16
-
</p><p>
17
-
Your class will have the method, <code>book(int start, int end)</code>. Formally, this represents a booking on the half open interval <code>[start, end)</code>, the range of real numbers <code>x</code> such that <code>start <= x < end</code>.
18
-
</p><p>
19
-
A <i>double booking</i> happens when two events have some non-empty intersection (ie., there is some time that is common to both events.)
20
-
</p><p>
21
-
For each call to the method <code>MyCalendar.book</code>, return <code>true</code> if the event can be added to the calendar successfully without causing a double booking. Otherwise, return <code>false</code> and do not add the event to the calendar.
22
-
</p>
23
-
24
-
Your class will be called like this:
25
-
<code>MyCalendar cal = new MyCalendar();</code>
26
-
<code>MyCalendar.book(start, end)</code>
27
-
28
-
<p><b>Example 1:</b><br />
14
+
<p>Implement a <code>MyCalendar</code> class to store your events. A new event can be added if adding the event will not cause a double booking.</p>
15
+
16
+
<p>Your class will have the method, <code>book(int start, int end)</code>. Formally, this represents a booking on the half open interval <code>[start, end)</code>, the range of real numbers <code>x</code> such that <code>start <= x < end</code>.</p>
17
+
18
+
<p>A <i>double booking</i> happens when two events have some non-empty intersection (ie., there is some time that is common to both events.)</p>
19
+
20
+
<p>For each call to the method <code>MyCalendar.book</code>, return <code>true</code> if the event can be added to the calendar successfully without causing a double booking. Otherwise, return <code>false</code> and do not add the event to the calendar.</p>
21
+
Your class will be called like this: <code>MyCalendar cal = new MyCalendar();</code> <code>MyCalendar.book(start, end)</code>
22
+
23
+
<p><b>Example 1:</b></p>
24
+
29
25
<pre>
30
26
MyCalendar();
31
27
MyCalendar.book(10, 20); // returns true
32
28
MyCalendar.book(15, 25); // returns false
33
29
MyCalendar.book(20, 30); // returns true
34
30
<b>Explanation:</b>
35
-
The first event can be booked. The second can't because time 15 is already booked by another event.
31
+
The first event can be booked. The second can't because time 15 is already booked by another event.
36
32
The third event can be booked, as the first event takes every time less than 20, but not including 20.
37
33
</pre>
38
-
</p>
39
34
40
-
<p><b>Note:</b>
41
-
<li>The number of calls to <code>MyCalendar.book</code> per test case will be at most <code>1000</code>.</li>
42
-
<li>In calls to <code>MyCalendar.book(start, end)</code>, <code>start</code> and <code>end</code> are integers in the range <code>[0, 10^9]</code>.</li>
43
-
</p>
35
+
<p> </p>
36
+
37
+
<p><b>Note:</b></p>
38
+
39
+
<ul>
40
+
<li>The number of calls to <code>MyCalendar.book</code> per test case will be at most <code>1000</code>.</li>
41
+
<li>In calls to <code>MyCalendar.book(start, end)</code>, <code>start</code> and <code>end</code> are integers in the range <code>[0, 10^9]</code>.</li>
Copy file name to clipboardExpand all lines: problems/my-calendar-ii/README.md
+22-21Lines changed: 22 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,21 +11,17 @@
11
11
12
12
## 731. My Calendar II (Medium)
13
13
14
-
<p>
15
-
Implement a <code>MyCalendarTwo</code> class to store your events. A new event can be added if adding the event will not cause a <b>triple</b> booking.
16
-
</p><p>
17
-
Your class will have one method, <code>book(int start, int end)</code>. Formally, this represents a booking on the half open interval <code>[start, end)</code>, the range of real numbers <code>x</code> such that <code>start <= x < end</code>.
18
-
</p><p>
19
-
A <i>triple booking</i> happens when <b>three</b> events have some non-empty intersection (ie., there is some time that is common to all 3 events.)
20
-
</p><p>
21
-
For each call to the method <code>MyCalendar.book</code>, return <code>true</code> if the event can be added to the calendar successfully without causing a <b>triple</b> booking. Otherwise, return <code>false</code> and do not add the event to the calendar.
22
-
</p>
23
-
24
-
Your class will be called like this:
25
-
<code>MyCalendar cal = new MyCalendar();</code>
26
-
<code>MyCalendar.book(start, end)</code>
27
-
28
-
<p><b>Example 1:</b><br />
14
+
<p>Implement a <code>MyCalendarTwo</code> class to store your events. A new event can be added if adding the event will not cause a <b>triple</b> booking.</p>
15
+
16
+
<p>Your class will have one method, <code>book(int start, int end)</code>. Formally, this represents a booking on the half open interval <code>[start, end)</code>, the range of real numbers <code>x</code> such that <code>start <= x < end</code>.</p>
17
+
18
+
<p>A <i>triple booking</i> happens when <b>three</b> events have some non-empty intersection (ie., there is some time that is common to all 3 events.)</p>
19
+
20
+
<p>For each call to the method <code>MyCalendar.book</code>, return <code>true</code> if the event can be added to the calendar successfully without causing a <b>triple</b> booking. Otherwise, return <code>false</code> and do not add the event to the calendar.</p>
21
+
Your class will be called like this: <code>MyCalendar cal = new MyCalendar();</code> <code>MyCalendar.book(start, end)</code>
The first two events can be booked. The third event can be double booked.
39
-
The fourth event (5, 15) can't be booked, because it would result in a triple booking.
35
+
The fourth event (5, 15) can't be booked, because it would result in a triple booking.
40
36
The fifth event (5, 10) can be booked, as it does not use time 10 which is already double booked.
41
37
The sixth event (25, 55) can be booked, as the time in [25, 40) will be double booked with the third event;
42
38
the time [40, 50) will be single booked, and the time [50, 55) will be double booked with the second event.
43
39
</pre>
44
-
</p>
45
40
46
-
<p><b>Note:</b>
47
-
<li>The number of calls to <code>MyCalendar.book</code> per test case will be at most <code>1000</code>.</li>
48
-
<li>In calls to <code>MyCalendar.book(start, end)</code>, <code>start</code> and <code>end</code> are integers in the range <code>[0, 10^9]</code>.</li>
49
-
</p>
41
+
<p> </p>
42
+
43
+
<p><b>Note:</b></p>
44
+
45
+
<ul>
46
+
<li>The number of calls to <code>MyCalendar.book</code> per test case will be at most <code>1000</code>.</li>
47
+
<li>In calls to <code>MyCalendar.book(start, end)</code>, <code>start</code> and <code>end</code> are integers in the range <code>[0, 10^9]</code>.</li>
Copy file name to clipboardExpand all lines: problems/not-boring-movies/README.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,13 @@
11
11
12
12
## 620. Not Boring Movies (Easy)
13
13
14
-
X city opened a new cinema, many people would like to go to this cinema.
15
-
The cinema also gives out a poster indicating the movies’ ratings and descriptions. <p/>
16
-
17
-
Please write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.
18
-
<p/>
19
-
<p>
20
-
For example, table <code>cinema</code>:
14
+
X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a poster indicating the movies’ ratings and descriptions.
15
+
<p>Please write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.</p>
0 commit comments