423. Reconstruct Original Digits from English

selveral priority to choose which char to represent corresponding english number: unique among all english numbers. less freqency in other words if not unique Also, note ```python class Solution: def originalDigits(self, s: str) -> str: “”” zero z one o 1-0-2-4 two w three h 3-8 four u five v... [Read More]
Tags: Math

706. Design HashMap

# time O(2N) space O(1) class Solution: def lengthOfLongestSubstring(self, s: str) -> int: l, r = 0, 0 d = {} res = 0 while r < len(s): if s[r] not in d: d[s[r]] = 1 else: d[s[r]] += 1 while d[s[r]] > 1: d[s[l]] -= 1 l += 1... [Read More]

303. Range Sum Query - Immutable

```python class NumArray: # time O(N) space O(1) def init(self, nums: List[int]): n = len(nums) self.psum = [0] * (n+1) for i in range(n): self.psum[i+1] = self.psum[i] + nums[i]# psun[i]: sum of num[0]++num[i] [Read More]
Tags: DP

489. Robot Room Cleaner

```python ””” This is the robot’s control interface. You should not implement it, or speculate about its implementation ””” #class Robot: def move(self): ””” Returns true if the cell in front is open and robot moves into the cell. Returns false if the cell in front is blocked and robot... [Read More]
Tags: DFS