# Leetcode Top Interview 🎯

![](https://custom-icon-badges.herokuapp.com/badge/Java-E34F26.svg?logo=java\&logoColor=white) ![](https://img.shields.io/badge/Sublime_Text-%23575757.svg?logo=sublime-text\&logoColor=important) ![](https://img.shields.io/badge/Neovim-57A143.svg?logo=Neovim\&logoColor=white) ![](https://img.shields.io/badge/Visual_Studio_Code-0078D4?logo=visual%20studio%20code\&logoColor=white) ![](https://img.shields.io/badge/Progress-74%2F150-0078D4)

This repository contains solutions to the Leetcode Top Interview 150 problems.

These problems are commonly asked in technical interviews and cover a wide range of topics, including data structures, algorithms, and problem-solving techniques.

[![Leetcode Stats](https://leetcard.jacoblin.cool/ChunhThanhDe?ext=contest)](https://leetcode.com/ChunhThanhDe)

Show some ❤️ by starring ⭐ this repository if you like it!

> If you want to support me, help me sub my YouTube channel [CHUNGCINE](https://www.youtube.com/@CHUNGCINE?sub_confirmation=1). Thank you so much <3

**Contact for work, email: chunhthanhde.dev@gmail.com**

![LeetCode Logo](https://leetcode.com/static/images/LeetCode_logo.png)

![GitHub stars](https://img.shields.io/github/stars/ChunhThanhDe/Leetcode-Top-Interview?style=social) ![GitHub forks](https://img.shields.io/github/forks/ChunhThanhDe/Leetcode-Top-Interview?style=social) ![GitHub watchers](https://img.shields.io/github/watchers/ChunhThanhDe/Leetcode-Top-Interview?style=social)

![linkedin](https://img.shields.io/badge/Support-Recommend%2FEndorse%20me%20on%20Linkedin-blue?style=for-the-badge\&logo=linkedin)

[![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png)](https://www.buymeacoffee.com/chunhthanhde)

## Table of Contents 📖

* [**What is Leetcode? 🧑‍💻**](#what-is-leetcode-)
* [**About the Top Interview 150 Collection Questions 🏆**](#about-the-top-interview-150-collection-)
* [**Tips for Solving Problems 💡**](#tips-for-solving-problems-)
* [**Repository Structure 🗂️**](#repository-structure-️)
* [**How to Use This Repository 🚀**](#how-to-use-this-repository-)
* [**Resources 📚**](#resources-)

## What is Leetcode? 🧑‍💻

[Leetcode](https://leetcode.com/) is a popular online platform that provides a collection of coding challenges. Software engineers and interview candidates widely use it to practice coding skills and prepare for technical interviews. Leetcode offers many problems to solve, classified by difficulty level and topic.

## About the Top Interview 150 Collection 🏆

![](https://img.shields.io/badge/Progress-74%2F150-0078D4)

The Top Interview 150 collection on Leetcode is a curated set of 150 interview questions that top tech companies frequently ask. These questions are carefully selected to cover essential concepts and algorithms that interviewers expect candidates to be familiar with.

| Id                      | Problem                                                                                                                                                                                                        | Difficulty | Signal | Status |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------ | ------ |
| **Array / String**      |                                                                                                                                                                                                                |            |        |        |
| 1                       | [Merge Sorted Array](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/001-merge-sorted-array)                                                                                       | Easy       | 🟢     | ✅      |
| 2                       | [Remove Element](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/002-remove-element)                                                                                               | Easy       | 🟢     | ✅      |
| 3                       | [Remove Duplicates from Sorted Array](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/003-remove-duplicates-from-sorted-array)                                                     | Easy       | 🟢     | ✅      |
| 4                       | [Remove Duplicates from Sorted Array II](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/004-remove-duplicates-from-sorted-array-ii)                                               | Medium     | 🟡     | ✅      |
| 5                       | [Majority Element](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/005-majority-element)                                                                                           | Easy       | 🟢     | ✅      |
| 6                       | [Rotate Array](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/006-rotate-array)                                                                                                   | Medium     | 🟡     | ✅      |
| 7                       | [Best Time to Buy and Sell Stock](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/007-best-time-to-buy-and-sell-stock)                                                             | Easy       | 🟢     | ✅      |
| 8                       | [Best Time to Buy and Sell Stock II](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/008-best-time-to-buy-and-sell-stock-ii)                                                       | Medium     | 🟡     | ✅      |
| 9                       | [Jump Game](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/009-jump-game)                                                                                                         | Medium     | 🟡     | ✅      |
| 10                      | [Jump Game II](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/010-jump-game-ii)                                                                                                   | Medium     | 🟡     | ✅      |
| 11                      | [H-Index](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/011-h-index)                                                                                                             | Medium     | 🟡     | ✅      |
| 12                      | [Insert Delete GetRandom O(1)](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/012-insert-delete-getrandom)                                                                        | Medium     | 🟡     | ✅      |
| 13                      | [Product of Array Except Self](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/013-product-of-array-except-self)                                                                   | Medium     | 🟡     | ✅      |
| 14                      | [Gas Station](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/014-gas-station)                                                                                                     | Medium     | 🟡     | ✅      |
| 15                      | [Candy](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/015-candy)                                                                                                                 | Hard       | 🔴     | ✅      |
| 16                      | [Trapping Rain Water](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/016-trapping-rain-water)                                                                                     | Hard       | 🔴     | ✅      |
| 17                      | [Roman to Integer](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/017-roman-to-integer)                                                                                           | Easy       | 🟢     | ✅      |
| 18                      | [Integer to Roman](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/018-integer-to-roman)                                                                                           | Medium     | 🟡     | ✅      |
| 19                      | [Length of Last Word](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/019-length-of-last-word)                                                                                     | Easy       | 🟢     | ✅      |
| 20                      | [Longest Common Prefix](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/020-longest-common-prefix)                                                                                 | Easy       | 🟢     | ✅      |
| 21                      | [Reverse Words in a String](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/021-reverse-words-in-a-string)                                                                         | Medium     | 🟡     | ✅      |
| 22                      | [Zigzag Conversion](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/022-zigzag-conversion)                                                                                         | Medium     | 🟡     | ✅      |
| 23                      | [Find the Index of the First Occurrence in a String](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/023-find-the-index-of-the-first-occurrence-in-a-string)                       | Easy       | 🟢     | ✅      |
| 24                      | [Text Justification](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-1-array-string/024-text-justification)                                                                                       | Hard       | 🔴     | ✅      |
| **Two Pointers**        |                                                                                                                                                                                                                |            |        |        |
| 25                      | [Valid Palindrome](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-2-two-pointers/025-valid-palindrome)                                                                                           | Easy       | 🟢     | ✅      |
| 26                      | [Is Subsequence](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-2-two-pointers/026-is-subsequence)                                                                                               | Easy       | 🟢     | ✅      |
| 27                      | [Two Sum II - Input Array Is Sorted](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-2-two-pointers/027-two-sum-ii-input-array-is-sorted)                                                         | Medium     | 🟡     | ✅      |
| 28                      | [Container With Most Water](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-2-two-pointers/028-container-with-most-water)                                                                         | Medium     | 🟡     | ✅      |
| 29                      | [3Sum](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-2-two-pointers/029-3sum)                                                                                                                   | Medium     | 🟡     | ✅      |
| **Sliding Window**      |                                                                                                                                                                                                                |            |        |        |
| 30                      | [Minimum Size Subarray Sum](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-3-sliding-window/030-minimum-size-subarray-sum)                                                                       | Medium     | 🟡     | ✅      |
| 31                      | [Longest Substring Without Repeating Characters](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-3-sliding-window/031-longest-substring-without-repeating-characters)                             | Medium     | 🟡     | ✅      |
| 32                      | [Substring with Concatenation of All Words](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-3-sliding-window/032-substring-with-concatenation-of-all-words)                                       | Hard       | 🔴     | ✅      |
| 33                      | [Minimum Window Substring](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-3-sliding-window/033-minimum-window-substring)                                                                         | Hard       | 🔴     | ✅      |
| **Matrix**              |                                                                                                                                                                                                                |            |        |        |
| 34                      | [Valid Sudoku](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-4-matrix/034-valid-sudoku)                                                                                                         | Medium     | 🟡     | ✅      |
| 35                      | [Spiral Matrix](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-4-matrix/035-spiral-matrix)                                                                                                       | Medium     | 🟡     | ✅      |
| 36                      | [Rotate Image](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-4-matrix/036-rotate-image)                                                                                                         | Medium     | 🟡     | ✅      |
| 37                      | [Set Matrix Zeroes](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-4-matrix/037-set-matrix-zeroes)                                                                                               | Medium     | 🟡     | ✅      |
| 38                      | [Game of Life](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-4-matrix/038-the-game-of-life)                                                                                                     | Medium     | 🟡     | ✅      |
| **Hashmap**             |                                                                                                                                                                                                                |            |        |        |
| 39                      | [Ransom Note](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/039-ransom-note)                                                                                                          | Easy       | 🟢     | ✅      |
| 40                      | [Isomorphic Strings](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/040-isomorphic-strings)                                                                                            | Easy       | 🟢     | ✅      |
| 41                      | [Word Pattern](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/041-word-pattern)                                                                                                        | Easy       | 🟢     | ✅      |
| 42                      | [Valid Anagram](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/042-valid-anagram)                                                                                                      | Easy       | 🟢     | ✅      |
| 43                      | [Group Anagrams](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/043-group-anagrams)                                                                                                    | Medium     | 🟡     | ✅      |
| 44                      | [Two Sum](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/044-two-sum)                                                                                                                  | Easy       | 🟢     | ✅      |
| 45                      | [Happy Number](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/045-happy-number)                                                                                                        | Easy       | 🟢     | ✅      |
| 46                      | [Contains Duplicate II](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/046-contains-duplicate-ii)                                                                                      | Easy       | 🟢     | ✅      |
| 47                      | [Longest Consecutive Sequence](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-5-hashmap/047-longest-consecutive-sequence)                                                                        | Medium     | 🟡     | ✅      |
| **Intervals**           |                                                                                                                                                                                                                |            |        |        |
| 48                      | [Summary Ranges](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-6-intervals/048-summary-ranges)                                                                                                  | Easy       | 🟢     | ✅      |
| 49                      | [Merge Intervals](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-6-intervals/049-merge-intervals)                                                                                                | Medium     | 🟡     | ✅      |
| 50                      | [Insert Interval](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-6-intervals/050-insert-interval)                                                                                                | Medium     | 🟡     | ✅      |
| 51                      | [Minimum Number of Arrows to Burst Balloons](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-6-intervals/051-minimum-number-of-arrows-to-burst-balloons)                                          | Medium     | 🟡     | ✅      |
| **Stack**               |                                                                                                                                                                                                                |            |        |        |
| 52                      | [Valid Parentheses](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-7-stack/052-valid-parentheses)                                                                                                | Easy       | 🟢     | ✅      |
| 53                      | [Simplify Path](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-7-stack/053-simplify-path)                                                                                                        | Medium     | 🟡     | ✅      |
| 54                      | [Min Stack](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-7-stack/054-min-stack)                                                                                                                | Medium     | 🟡     | ✅      |
| 55                      | [Evaluate Reverse Polish Notation](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-7-stack/055-evaluate-reverse-polish-notation)                                                                  | Medium     | 🟡     | ✅      |
| 56                      | [Basic Calculator](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-7-stack/056-basic-calculator)                                                                                                  | Hard       | 🔴     | ✅      |
| **Linked List**         |                                                                                                                                                                                                                |            |        |        |
| 57                      | [Linked List Cycle](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/057-linked-list-cycle)                                                                                          | Easy       | 🟢     | ✅      |
| 58                      | [Add Two Numbers](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/058-add-two-numbers)                                                                                              | Medium     | 🟡     | ✅      |
| 59                      | [Merge Two Sorted Lists](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/059-merge-two-sorted-lists)                                                                                | Easy       | 🟢     | ✅      |
| 60                      | [Copy List with Random Pointer](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/060-copy-list-with-random-pointer)                                                                  | Medium     | 🟡     | ✅      |
| 61                      | [Reverse Linked List II](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/061-reverse-linked-list-ii)                                                                                | Medium     | 🟡     | ✅      |
| 62                      | [Reverse Nodes in k-Group](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/062-reverse-nodes-in-k-group)                                                                            | Hard       | 🔴     | ✅      |
| 63                      | [Remove Nth Node From End of List](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/063-remove-nth-node-from-end-of-list)                                                            | Medium     | 🟡     | ✅      |
| 64                      | [Remove Duplicates from Sorted List II](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/064-remove-duplicates-from-sorted-list-ii)                                                  | Medium     | 🟡     | ✅      |
| 65                      | [Rotate List](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/065-rotate-list)                                                                                                      | Medium     | 🟡     | ✅      |
| 66                      | [Partition List](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/066-partition-list)                                                                                                | Medium     | 🟡     | ✅      |
| 67                      | [LRU Cache](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-8-linked-list/067-lru-cache)                                                                                                          | Medium     | 🟡     | ✅      |
| **Binary Tree General** |                                                                                                                                                                                                                |            |        |        |
| 68                      | [Maximum Depth of Binary Tree](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-9-binary-tree-general/068-maximum-depth-of-binary-tree)                                                            | Easy       | 🟢     | ✅      |
| 69                      | [Same Tree](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-9-binary-tree-general/069-same-tree)                                                                                                  | Easy       | 🟢     | ✅      |
| 70                      | [Invert Binary Tree](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-9-binary-tree-general/070-invert-binary-tree)                                                                                | Easy       | 🟢     | ✅      |
| 71                      | [Symmetric Tree](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-9-binary-tree-general/071-symmetric-tree)                                                                                        | Easy       | 🟢     | ✅      |
| 72                      | [Construct Binary Tree from Preorder and Inorder Traversal](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-9-binary-tree-general/072-construct-binary-tree-from-preorder-and-inorder-traversal)  | Medium     | 🟡     | ✅      |
| 73                      | [Construct Binary Tree from Inorder and Postorder Traversal](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-9-binary-tree-general/072-construct-binary-tree-from-preorder-and-inorder-traversal) | Medium     | 🟡     | ✅      |
| 74                      | [Populating Next Right Pointers in Each Node II](https://chunhthanhde.gitbook.io/leetcode-top-interview/topic-9-binary-tree-general/074-populating-next-right-pointers-in-each-node-ii)                        | Medium     | 🟡     | ✅      |
| 75                      | Flatten Binary Tree to Linked List                                                                                                                                                                             | Medium     | 🟡     |        |
| 76                      | Path Sum                                                                                                                                                                                                       | Easy       | 🟢     |        |
| 77                      | Sum Root to Leaf Numbers                                                                                                                                                                                       | Medium     | 🟡     |        |
| 78                      | Binary Tree Maximum Path Sum                                                                                                                                                                                   | Hard       | 🔴     |        |
| 79                      | Binary Search Tree Iterator                                                                                                                                                                                    | Medium     | 🟡     |        |
| 80                      | Count Complete Tree Nodes                                                                                                                                                                                      | Easy       | 🟢     |        |
| 81                      | Lowest Common Ancestor of a Binary Tree                                                                                                                                                                        | Medium     | 🟡     |        |
| **Binary Tree BFS**     |                                                                                                                                                                                                                |            |        |        |
| 8282                    | Binary Tree Right Side View                                                                                                                                                                                    | Medium     | 🟡     |        |
| 83                      | Average of Levels in Binary Tree                                                                                                                                                                               | Easy       | 🟢     |        |
| 84                      | Binary Tree Level Order Traversal                                                                                                                                                                              | Medium     | 🟡     |        |
| 85                      | Binary Tree Zigzag Level Order Traversal                                                                                                                                                                       | Medium     | 🟡     |        |
| **Binary Search Tree**  |                                                                                                                                                                                                                |            |        |        |
| 86                      | Minimum Absolute Difference in BST                                                                                                                                                                             | Easy       | 🟢     |        |
| 87                      | Kth Smallest Element in a BST                                                                                                                                                                                  | Medium     | 🟡     |        |
| 88                      | Validate Binary Search Tree                                                                                                                                                                                    | Medium     | 🟡     |        |
| **Graph General**       |                                                                                                                                                                                                                |            |        |        |
| 89                      | Number of Islands                                                                                                                                                                                              | Medium     | 🟡     |        |
| 90                      | Surrounded Regions                                                                                                                                                                                             | Medium     | 🟡     |        |
| 91                      | Clone Graph                                                                                                                                                                                                    | Medium     | 🟡     |        |
| 92                      | Evaluate Division                                                                                                                                                                                              | Medium     | 🟡     |        |
| 93                      | Course Schedule                                                                                                                                                                                                | Medium     | 🟡     |        |
| 94                      | Course Schedule II                                                                                                                                                                                             | Medium     | 🟡     |        |
| **Graph BFS**           |                                                                                                                                                                                                                |            |        |        |
| 95                      | Snakes and Ladders                                                                                                                                                                                             | Medium     | 🟡     |        |
| 96                      | Minimum Genetic Mutation                                                                                                                                                                                       | Medium     | 🟡     |        |
| 97                      | Word Ladder                                                                                                                                                                                                    | Hard       | 🔴     |        |
| **Trie**                |                                                                                                                                                                                                                |            |        |        |
| 98                      | Implement Trie (Prefix Tree)                                                                                                                                                                                   | Medium     | 🟡     |        |
| 99                      | Design Add and Search Words Data Structure                                                                                                                                                                     | Medium     | 🟡     |        |
| 100                     | Word Search II                                                                                                                                                                                                 | Hard       | 🔴     |        |
| **Backtracking**        |                                                                                                                                                                                                                |            |        |        |
| 101                     | Letter Combinations of a Phone Number                                                                                                                                                                          | Medium     | 🟡     |        |
| 102                     | Combinations                                                                                                                                                                                                   | Medium     | 🟡     |        |
| 103                     | Permutations                                                                                                                                                                                                   | Medium     | 🟡     |        |
| 104                     | Combination Sum                                                                                                                                                                                                | Medium     | 🟡     |        |
| 105                     | N-Queens II                                                                                                                                                                                                    | Hard       | 🔴     |        |
| 106                     | Generate Parentheses                                                                                                                                                                                           | Medium     | 🟡     |        |
| 107                     | Word Search                                                                                                                                                                                                    | Medium     | 🟡     |        |
| **Divide & Conquer**    |                                                                                                                                                                                                                |            |        |        |
| 108                     | Convert Sorted Array to Binary Search Tree                                                                                                                                                                     | Easy       | 🟢     |        |
| 109                     | Sort List                                                                                                                                                                                                      | Medium     | 🟡     |        |
| 110                     | Construct Quad Tree                                                                                                                                                                                            | Medium     | 🟡     |        |
| 111                     | Merge k Sorted Lists                                                                                                                                                                                           | Hard       | 🔴     |        |
| **Kadane's Algorithm**  |                                                                                                                                                                                                                |            |        |        |
| 112                     | Maximum Subarray                                                                                                                                                                                               | Medium     | 🟡     |        |
| 113                     | Maximum Sum Circular Subarray                                                                                                                                                                                  | Medium     | 🟡     |        |
| **Binary Search**       |                                                                                                                                                                                                                |            |        |        |
| 114                     | Search Insert Position                                                                                                                                                                                         | Easy       | 🟢     |        |
| 115                     | Search a 2D Matrix                                                                                                                                                                                             | Medium     | 🟡     |        |
| 116                     | Find Peak Element                                                                                                                                                                                              | Medium     | 🟡     |        |
| 117                     | Search in Rotated Sorted Array                                                                                                                                                                                 | Medium     | 🟡     |        |
| 118                     | Find First and Last Position of Element in Sorted Array                                                                                                                                                        | Medium     | 🟡     |        |
| 119                     | Find Minimum in Rotated Sorted Array                                                                                                                                                                           | Medium     | 🟡     |        |
| 120                     | Median of Two Sorted Arrays                                                                                                                                                                                    | Hard       | 🔴     |        |
| **Heap**                |                                                                                                                                                                                                                |            |        |        |
| 121                     | Kth Largest Element in an Array                                                                                                                                                                                | Medium     | 🟡     |        |
| 122                     | IPO                                                                                                                                                                                                            | Hard       | 🔴     |        |
| 123                     | Find K Pairs with Smallest Sums                                                                                                                                                                                | Medium     | 🟡     |        |
| 124                     | Find Median from Data Stream                                                                                                                                                                                   | Hard       | 🔴     |        |
| **Bit Manipulation**    |                                                                                                                                                                                                                |            |        |        |
| 125                     | Add Binary                                                                                                                                                                                                     | Easy       | 🟢     |        |
| 126                     | Reverse Bits                                                                                                                                                                                                   | Easy       | 🟢     |        |
| 127                     | Number of 1 Bits                                                                                                                                                                                               | Easy       | 🟢     |        |
| 128                     | Single Number                                                                                                                                                                                                  | Easy       | 🟢     |        |
| 129                     | Single Number II                                                                                                                                                                                               | Medium     | 🟡     |        |
| 130                     | Bitwise AND of Numbers Range                                                                                                                                                                                   | Medium     | 🟡     |        |
| **Math**                |                                                                                                                                                                                                                |            |        |        |
| 131                     | Palindrome Number                                                                                                                                                                                              | Easy       | 🟢     |        |
| 132                     | Plus One                                                                                                                                                                                                       | Easy       | 🟢     |        |
| 133                     | Factorial Trailing Zeroes                                                                                                                                                                                      | Medium     | 🟡     |        |
| 134                     | Sqrt(x)                                                                                                                                                                                                        | Easy       | 🟢     |        |
| 135                     | Pow(x, n)                                                                                                                                                                                                      | Medium     | 🟡     |        |
| 136                     | Max Points on a Line                                                                                                                                                                                           | Hard       | 🔴     |        |
| **1D DP**               |                                                                                                                                                                                                                |            |        |        |
| 137                     | Climbing Stairs                                                                                                                                                                                                | Easy       | 🟢     |        |
| 138                     | House Robber                                                                                                                                                                                                   | Medium     | 🟡     |        |
| 139                     | Word Break                                                                                                                                                                                                     | Medium     | 🟡     |        |
| 140                     | Coin Change                                                                                                                                                                                                    | Medium     | 🟡     |        |
| 141                     | Longest Increasing Subsequence                                                                                                                                                                                 | Medium     | 🟡     |        |
| **Multidimensional DP** |                                                                                                                                                                                                                |            |        |        |
| 142                     | Triangle                                                                                                                                                                                                       | Medium     | 🟡     |        |
| 143                     | Minimum Path Sum                                                                                                                                                                                               | Medium     | 🟡     |        |
| 144                     | Unique Paths II                                                                                                                                                                                                | Medium     | 🟡     |        |
| 145                     | Longest Palindromic Substring                                                                                                                                                                                  | Medium     | 🟡     |        |
| 146                     | Interleaving String                                                                                                                                                                                            | Medium     | 🟡     |        |
| 147                     | Edit Distance                                                                                                                                                                                                  | Medium     | 🟡     |        |
| 148                     | Best Time to Buy and Sell Stock III                                                                                                                                                                            | Hard       | 🔴     |        |
| 149                     | Best Time to Buy and Sell Stock IV                                                                                                                                                                             | Hard       | 🔴     |        |
| 150                     | Maximal Square                                                                                                                                                                                                 | Medium     | 🟡     |        |

## Tips for Solving Problems 💡

SSome helpful strategies to tackle different types of problems in this repository:

| **Strategy**                                                   | **Description**                                                                                                                                                | **Example Use Case**                                     |
| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| **Heap for Top K Elements 🔼**                                 | Use a Heap to find the top K largest, smallest, or closest elements among N elements. Efficient for problems requiring constant updates.                       | Finding the top K largest numbers in a list.             |
| **Binary Search or Two Pointers for Sorted Input 🔍➡️⬅️**      | Use Binary Search or Two Pointers for sorted arrays, lists, or matrices to optimize the solution.                                                              | Searching for an element in a sorted array.              |
| **Backtracking or BFS for Combinations and Permutations 🔄🔍** | Use Backtracking or BFS for problems requiring exploration of all combinations or permutations.                                                                | Finding all permutations of a set.                       |
| **BFS or DFS for Trees and Graphs 🌳🔗**                       | Use BFS or DFS for tree or graph-related problems.                                                                                                             | Searching a graph or binary tree.                        |
| **Stack for Converting Recursion to Iteration 📚**             | Convert recursion problems into iterative solutions using a stack to simulate the call stack.                                                                  | Performing a recursive search without using recursion.   |
| **Optimizing Array Problems 📊**                               | Optimize array problems from O(n²) to O(n) using a HashMap or Set, or to O(n log n) using sorting.                                                             | Finding duplicate elements in an array.                  |
| **Dynamic Programming for Optimization Problems 🚀**           | Dynamic Programming is essential for problems that involve maximizing or minimizing values, using results from previous subproblems.                           | Finding the maximum value in a sequence.                 |
| **Trie for String Manipulation 🔤**                            | For multiple strings or searching for common substrings, use a Trie or HashMap. A Trie is the most suitable data structure when manipulating multiple strings. | Searching or manipulating multiple strings efficiently.  |
| **Fast & Slow Pointers for Linked Lists 🔄🏃‍♂️🏃‍♀️**         | Use Fast & Slow Pointers to efficiently solve LinkedList problems with restricted memory usage, like detecting cycles or finding the middle element.           | Detecting cycles or finding the middle of a linked list. |

## Repository Structure 🗂️

This repository is organized by problem number, with each problem having its own directory.

Inside each problem directory, you will find the solution file(s) along with a README file that provides a problem description, constraints, and additional notes if necessary.

## How to Use This Repository 🚀

Navigate through the problem directories to explore solutions. Each directory contains the solution files, including explanations and sample input/output.

You can practice implementing your solutions and compare them with those provided.

Feel free to contribute by submitting your solutions or improvements. Open a pull request to share your contributions.

I recommend contributions for new languages, as currently, the solution is only available in Java 🐛.

## Resources 📚

* [Leetcode](https://leetcode.com/)
* [Top 150 Interview Questions - Leetcode](https://leetcode.com/studyplan/top-interview-150/)
* [GitBook Solution](https://chunhthanhde.gitbook.io/leetcode-top-interview)

Happy coding and good luck with your interview preparation! 🎉
