Lc1437

class Solution: def kLengthApart(self, nums: List[int], k: int) -> bool: res = [] for idx,val in enumerate(nums): if val == 1: res.append(idx) if not res and k == 0: return True for each in range(1,len(res)): if (res[each]-res[each-1]-1) < k: return False return True [Read More]

Lc1436

```python class Solution: # time& space O(N) def destCity(self, paths: List[List[str]]) -> str: if len(paths) == 1 : return paths[0][1] # step1, set up start_dic start_d = dict() # step2, iterate path in paths, check if destination in the path is a start in another path for path in paths:... [Read More]