Catalogue
Interval Schedule
435. Non-overlapping Intervals
- minimum number of removed intervels, maximum number of compatible intervals
- sort by end time !!! Why?
1 | class Solution(object): |
252. Meeting Rooms
1 | class Solution: |
253. Meeting Rooms II
1 | class Solution(object): |
Deadline Schedule
630. Course Schedule III
1 | class Solution(object): |
Arrive
55. Jump Game
- Use reach array will cause TLE
1
2
3
4
5
6
7
8
9
10class Solution(object):
def canJump(self, nums):
n = len(nums)
reach = 0
for i in xrange(n):
if i > reach:
return False
else:
reach = max(reach, i+nums[i])
return reach >= n-1
134. Gas Station
1 | class Solution(object): |