LC48 Image Rotate

```python “”” clockwise rotate first reverse up to down, then swap the symmetry 1 2 3 7 8 9 7 4 1 4 5 6 => 4 5 6 => 8 5 2 7 8 9 1 2 3 9 6 3 */””” class Solution: def rotate(self, matrix: List[List[int]]) ->... [Read More]
Tags: Array Stack

CandyCrush1D

refer ```python “”” main idea: loop through each char and count char that is same in the row, until encounter a different char, store previous char and cnt into stack; then check if candies can be crushed by checking top of stack, if yes, crush candies first before push new... [Read More]
Tags: Array Stack

LC165 Compare Version Numbers

class Solution: def compareVersion(self, version1: str, version2: str) -> int: """ step1: split '.' out of str and convert each segment into integer to remove leading 0 s and then save them to [] step2: find max length of the two lists. start loop each list step3: get current segment... [Read More]
Tags: String