Skip to content

Commit c5f1b23

Browse files
committed
Create README - LeetHub
1 parent be9b046 commit c5f1b23

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

0630-course-schedule-iii/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<h2><a href="https://leetcode.com/problems/course-schedule-iii">630. Course Schedule III</a></h2><h3>Hard</h3><hr><p>There are <code>n</code> different online courses numbered from <code>1</code> to <code>n</code>. You are given an array <code>courses</code> where <code>courses[i] = [duration<sub>i</sub>, lastDay<sub>i</sub>]</code> indicate that the <code>i<sup>th</sup></code> course should be taken <b>continuously</b> for <code>duration<sub>i</sub></code> days and must be finished before or on <code>lastDay<sub>i</sub></code>.</p>
2+
3+
<p>You will start on the <code>1<sup>st</sup></code> day and you cannot take two or more courses simultaneously.</p>
4+
5+
<p>Return <em>the maximum number of courses that you can take</em>.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre>
11+
<strong>Input:</strong> courses = [[100,200],[200,1300],[1000,1250],[2000,3200]]
12+
<strong>Output:</strong> 3
13+
Explanation:
14+
There are totally 4 courses, but you can take 3 courses at most:
15+
First, take the 1<sup>st</sup> course, it costs 100 days so you will finish it on the 100<sup>th</sup> day, and ready to take the next course on the 101<sup>st</sup> day.
16+
Second, take the 3<sup>rd</sup> course, it costs 1000 days so you will finish it on the 1100<sup>th</sup> day, and ready to take the next course on the 1101<sup>st</sup> day.
17+
Third, take the 2<sup>nd</sup> course, it costs 200 days so you will finish it on the 1300<sup>th</sup> day.
18+
The 4<sup>th</sup> course cannot be taken now, since you will finish it on the 3300<sup>th</sup> day, which exceeds the closed date.
19+
</pre>
20+
21+
<p><strong class="example">Example 2:</strong></p>
22+
23+
<pre>
24+
<strong>Input:</strong> courses = [[1,2]]
25+
<strong>Output:</strong> 1
26+
</pre>
27+
28+
<p><strong class="example">Example 3:</strong></p>
29+
30+
<pre>
31+
<strong>Input:</strong> courses = [[3,2],[4,3]]
32+
<strong>Output:</strong> 0
33+
</pre>
34+
35+
<p>&nbsp;</p>
36+
<p><strong>Constraints:</strong></p>
37+
38+
<ul>
39+
<li><code>1 &lt;= courses.length &lt;= 10<sup>4</sup></code></li>
40+
<li><code>1 &lt;= duration<sub>i</sub>, lastDay<sub>i</sub> &lt;= 10<sup>4</sup></code></li>
41+
</ul>

0 commit comments

Comments
 (0)