Lc1786

```python class Solution: def countRestrictedPaths(self, n: int, edges: List[List[int]]) -> int: “”” 1. build graph + dijkstra get min distance from node x to node n with map 2. start from nth node to ith node distance to make dis(i+1) < dis(i) ===> distance from current node to last node... [Read More]

1539. Kth Missing Positive Number

class Solution: def findKthPositive(self, arr: List[int], k: int) -> int: """ tc O(N) sc O(1) 1. set target tail value 2. loop arr, check if curren meet expected val 3. if no, get diff and compare with k 4. if k not reaching 0, continue the loop, otherwise return the... [Read More]

732. My Calendar III

Solution1: Sweep Line ```python “”” main idea: boundry count (dict + sort ) each event, store its start and end time, and mark change delta among whole timeline iterate whole timeline, based on mark to udpate accumutive intersection cnt compare with global max cnt “”” class MyCalendarThree: def init(self): self.timeline... [Read More]