Leetcode practice and solution (inspired by qiyuangong leetcode)
♥ means you need a subscription
| No. | Title | Code | Basic idea | Level |
|---|---|---|---|---|
| 990 | Satisfiability of Equality Equations | Python | 1. union-find 2. Create key and value 'a' to 'z' |
Medium |
| 989 | Add to Array-Form of Integer | Python | Array convert to integer | Easy |
| 988 | Smallest String Starting From Leaf | Python | 1. Using DFS and pop temp list until equal to level 2. Sort results and take the first one result |
Medium |
| 985 | Sum of Even Numbers After Queries | Python | 1. Calculate all even values of A 2. Subtract A[index] is even value and add value to A[index] and examine even values. | Easy |
| 984 | String Without AAA or BBB | Python | Decide A or B which is greater than the other, while(L-S >= 2 and L >= 2 and S >= 1), while(L > 0 and S > 0), add remaining 'a' or 'b' | Easy |
| 257 | Binary Tree Paths | Python | DFS, path_helper(cur, res, temp, level), pop() | Easy |
| 146 | LRU Cache | Python | Double Linked list, HashMap | Hard |
| 129 | Sum Root to Leaf Numbers | Python | DFS, calculate value each time | Medium |
| 2 | Add Two Numbers | Python | Linked List | Medium |
| 1 | Two Sum | Python | Hashmap | Easy |