-DSA A collection of LeetCode questions to ace the coding interview!
| Nếu đề bài nói... | Hướng suy nghĩ nên dùng |
|---|---|
| Kiểm tra dấu ngoặc, cặp mở – đóng | Stack |
| Tìm 2 số cộng lại = target | HashMap (Two Sum) |
| Tìm đoạn tăng, mua bán | Two Pointers, biến tạm |
| Đếm tần suất, ký tự lặp | Dictionary, HashMap |
| Tìm phần tử lớn nhất / nhỏ nhất | Biến max, min |
| Sắp xếp hoặc tìm thứ tự | Sort, Heap, Queue |
| Liên quan tới duyệt hết array | for, foreach |
| So sánh cặp phần tử | 2 vòng lặp (brute force) hoặc 2 pointers |
| 0020-valid-parentheses |
| 0020-valid-parentheses |
| 0021-merge-two-sorted-lists |
| 0206-reverse-linked-list |
| 0021-merge-two-sorted-lists |
| 0206-reverse-linked-list |
| 0001-two-sum |
| 0026-remove-duplicates-from-sorted-array |
| 0001-two-sum |
| 0026-remove-duplicates-from-sorted-array |