https://github.com/ladunjexa/the-leetcode
📑 LeetCode problems' Algorithms and Solutions implemented in common PL with explanations and links to further readings.
https://github.com/ladunjexa/the-leetcode
algorithms computer-science concurrency database interview-preparation javascript leetcode leetcode-solutions shell
Last synced: 4 months ago
JSON representation
📑 LeetCode problems' Algorithms and Solutions implemented in common PL with explanations and links to further readings.
- Host: GitHub
- URL: https://github.com/ladunjexa/the-leetcode
- Owner: ladunjexa
- License: mit
- Created: 2023-05-11T05:02:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-31T04:13:02.000Z (over 1 year ago)
- Last Synced: 2025-10-27T23:33:43.754Z (8 months ago)
- Topics: algorithms, computer-science, concurrency, database, interview-preparation, javascript, leetcode, leetcode-solutions, shell
- Language: Java
- Homepage: https://leetcode.com/ladunjexa/
- Size: 569 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README

# LeetCode Accepted Solutions
[](./LICENSE.md)

[](https://saythanks.io/to/kamyu104)



This repository contains accepted solutions of many problems from leetcode including related discussions if exists, coded in different programming languages.
Each problem has its own separate README with related explanations and examples for further reading (including ones to leetcode problem).
_Read source-code by Programming Languages:_
[_Java_](https://github.com/search?q=repo%3Aladunjexa%2Fthe-leetcode++language%3AJava&type=code),
[_C#_](https://github.com/search?q=repo%3Aladunjexa%2Fthe-leetcode++language%3ACSharp&type=code),
[_Python_](https://github.com/search?q=repo%3Aladunjexa%2Fthe-leetcode++language%3APython&type=code),
[_JavaScript_](https://github.com/search?q=repo%3Aladunjexa%2Fthe-leetcode++language%3AJavaScript&type=code),
[_TypeScript_](https://github.com/search?q=repo%3Aladunjexa%2Fthe-leetcode++language%3ATypeScript&type=code)
*☝ Note that this project is meant to be used for learning and researching purposes
only, and it is **not** meant to be used for production.*
Table of Contents
- [Folder Structure](#bangbang-folder-structure)
- [Contents](#information_source-contents)
* [Algorithms](#algorithms)
* [Database](#database)
* [Shell](#shell)
* [JavaScript](#javascript)
* [Concurrency](#concurrency)
- [Algorithms](#rocket-algorithms)
- [JavaScript](#zap-javascript)
- [Database](#baggage_claim-database)
- [Shell](#key-shell)
- [Concurrency](#fire-concurrency)
- [Useful Information](#scroll-useful-information)
* [References](#references)
* [Big O Notation](#big-o-notation)
* [Data Structure Operations Complexity](#data-structure-operations-complexity)
* [Array Sorting Algorithms Complexity](#array-sorting-algorithms-complexity)
- [Contributing](#wave-contributing)
- [License](#warning-license)
- [Author](#handshake-author)
## :bangbang: Folder Structure
Here is the folder structure.
```bash
leetcode/
|- algorithms/
|- concurrency/
|- database/
|- javascript/
|- shell/
ALL FOLDERS ABOVE IN-STRUCTURE IS:
|-- {problem}/
|-- Solution.{...}
|-- README.md
```
## :information_source: Contents
### Algorithms
* [Bit Manipulation](#bit-manipulation)
* [Array](#array)
* [String](#string)
* [Linked List](#linked-list)
* [Doubly Linked List](#doubly-linked-list)
* [Stack](#stack)
* [Monotonic Stack](#monotonic-stack)
* [Monotonic Queue](#monotonic-queue)
* [Queue](#queue)
* [Tree](#tree)
* [Hash Table](#hash-table)
* [Math](#math)
* [Two Pointers](#two-pointers)
* [Recursion](#recursion)
* [Binary Search](#binary-search)
* [Binary Tree](#binary-tree)
* [Breadth-First Search](#breadth-first-search)
* [Depth-First Search](#depth-first-search)
* [Backtracking](#backtracking)
* [Dynamic Programming](#dynamic-programming)
* [Divide and Conquer](#divide-and-conquer)
* [Memoization](#memoization)
* [Greedy](#greedy)
* [Graph](#graph)
* [Heap (Priority Queue)](#heap-priority-queue)
* [Quickselect](#quickselect)
* [Shortest Path](#shortest-path)
* [Geometry](#geometry)
* [Simulation](#simulation)
* [Design](#design)
* [Brainteaser](#brainteaser)
* [Game Theory](#game-theory)
* [Sorting](#sorting)
* [Prefix Sum](#prefix-sum)
* [Sliding Window](#sliding-window)
* [Data Stream](#data-stream)
* [Concurrency](#concurrency)
* [Combinatorics](#combinatorics)
* [Counting](#counting)
* [Union Find](#union-find)
* [Topological Sort](#topological-sort)
* [Bucket Sort](#bucket-sort)
* [Merge Sort](#merge-sort)
### Database
* [SQL](#sql)
### Shell
* [Shell Script](#shell-script)
### JavaScript
* [JS](#js)
### Concurrency
* [Concurrency](#concurrency)
## :rocket: Algorithms
### Bit Manipulation
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|67| [Add Binary](https://leetcode.com/problems/add-binary/) | [Java](./Algorithms/0067-Add-Binary/) | *N/A* | *N/A* |  ||
|78| [Subsets](https://leetcode.com/problems/subsets/) | [Java](./Algorithms/0078-Subsets/) | *N/A* | *N/A* |  ||
|136| [Single Number](https://leetcode.com/problems/single-number/) | [Java](./Algorithms/0136-Single-Number/) | *N/A* | *N/A* |  ||
|190| [Reverse Bits](https://leetcode.com/problems/reverse-bits/) | [Java](./Algorithms/0190-Reverse-Bits/) | *N/A* | *N/A* |  ||
|191| [Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits/) | [Java](./Algorithms/0191-Number-of-1-Bits/) | *N/A* | *N/A* |  ||
|231| [Power of Two](https://leetcode.com/problems/power-of-two/) | [Java](./Algorithms/0231-Power-of-Two/) | *N/A* | *N/A* |  ||
|268| [Missing Number](https://leetcode.com/problems/missing-number/) | [Java](./Algorithms/268-missing-number/) | *N/A* | *N/A* |  ||
|287| [Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number/) | [Java](./Algorithms/287-find-the-duplicate-number/) | *N/A* | *N/A* |  ||
|338| [Counting Bits](https://leetcode.com/problems/counting-bits/) | [Java](./Algorithms/0338-counting-bits/) | *N/A* | *N/A* |  ||
|342| [Power of Four](https://leetcode.com/problems/power-of-four/) | [Java](./Algorithms/0342-Power-of-Four/) | *N/A* | *N/A* |  ||
|389| [Find the Difference](https://leetcode.com/problems/find-the-difference/) | [Java](./Algorithms/0389-find-the-difference/) | *N/A* | *N/A* |  ||
|784| [Letter Case Permutation](https://leetcode.com/problems/letter-case-permutation/description/) | [Java](./Algorithms/0784-Letter-Case-Permutation/) | *O(2^n)* | *O(2^n)* |  | [View](https://leetcode.com/problems/letter-case-permutation/solutions/3530308/java-easy-to-understand-o-2-n-dfs-recursion-using-backtracking/) discussion on leetcode |
|1318| [Minimum Flips to Make a OR b Equal to c](https://leetcode.com/problems/minimum-flips-to-make-a-or-b-equal-to-c/) | [Java](./Algorithms/1318-minimum-flips-to-make-a-or-b-equal-to-c/) | *N/A* | *N/A* |  ||
|1342| [Number of Steps to Reduce a Number to Zero](https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/) | [Java](./Algorithms/1342-Number-of-Steps-to-Reduce-a-Number-to-Zero/) | *N/A* | *N/A* |  ||
|1863| [Sum of All Subset XOR Totals](https://leetcode.com/problems/sum-of-all-subsets-xor-totals/) | [Java](./Algorithms/1863-Sum-of-All-Subset-XOR-Totals/) | *N/A* | *N/A* |  ||
### Backtracking
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|17| [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/) | [Java](./Algorithms/0017-Letter-Combinations-of-a-Phone-Number/) | *N/A* | *N/A* |  ||
|22| [Generate Parentheses](https://leetcode.com/problems/generate-parentheses/) | [Java](./Algorithms/0022-Generate-Parentheses/) | *N/A* | *N/A* |  ||
|37| [Sudoku Solver](https://leetcode.com/problems/sudoku-solver/) | [Java](./Algorithms/0037-sudoku-solver/) | *N/A* | *N/A* |  ||
|39| [Combination Sum](https://leetcode.com/problems/combination-sum/) | [Java](./Algorithms/39-combination-sum/) | *N/A* | *N/A* |  ||
|51| [N-Queens](https://leetcode.com/problems/n-queens/) | [Java](./Algorithms/51-n-queens/) | *N/A* | *N/A* |  ||
|77| [Combinations](https://leetcode.com/problems/combinations/) | [Java](./Algorithms/77-combinations/) | *N/A* | *N/A* |  ||
|78| [Subsets](https://leetcode.com/problems/subsets/) | [Java](./Algorithms/0078-Subsets/) | *N/A* | *N/A* |  ||
|79| [Word Search](https://leetcode.com/problems/word-search/) | [Java](./Algorithms/79-word-search/) | *N/A* | *N/A* |  ||
|131| [Palindrome Partitioning](https://leetcode.com/problems/palindrome-partitioning/) | [Java](./Algorithms/131-palindrome-partitioning/) | *N/A* | *N/A* |  ||
|216| [Combination Sum III](https://leetcode.com/problems/combination-sum-iii/) | [Java](./Algorithms/216-combination-sum-iii/) | *N/A* | *N/A* |  ||
|257| [Binary Tree Paths](https://leetcode.com/problems/binary-tree-paths/) | [Java](./Algorithms/0257-binary-tree-paths/) | *N/A* | *N/A* |  ||
|784| [Letter Case Permutation](https://leetcode.com/problems/letter-case-permutation/description/) | [Java](./Algorithms/0784-Letter-Case-Permutation/) | *O(2^n)* | *O(2^n)* |  | [View](https://leetcode.com/problems/letter-case-permutation/solutions/3530308/java-easy-to-understand-o-2-n-dfs-recursion-using-backtracking/) discussion on leetcode |
|1863| [Sum of All Subset XOR Totals](https://leetcode.com/problems/sum-of-all-subsets-xor-totals/) | [Java](./Algorithms/1863-Sum-of-All-Subset-XOR-Totals/) | *N/A* | *N/A* |  ||
### Design
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|146| [LRU Cache](https://leetcode.com/problems/lru-cache/) | [Java](./Algorithms/146-LRU-Cache/) | *N/A* | *N/A* |  ||
|155| [Min Stack](https://leetcode.com/problems/min-stack/) | [Java](./Algorithms/155-Min-Stack/) | *N/A* | *N/A* |  ||
|208| [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/) | [Java](./Algorithms/0208-Implement-Trie-(Prefix-Tree)) | *N/A* | *N/A* |  ||
|225| [Implement Stack using Queues](https://leetcode.com/problems/implement-stack-using-queues/) | [Java](./Algorithms/0225-implement-stack-using-queues/) | *N/A* | *N/A* |  ||
|232| [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/) | [Java](./Algorithms/0232-implement-queue-using-stacks/) | *N/A* | *N/A* |  ||
|295| [Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/) | [Java](./Algorithms/295-Find-Median-from-Data-Stream/) | *N/A* | *N/A* |  ||
|901| [Online Stock Span](https://leetcode.com/problems/online-stock-span/) | [Java](./Algorithms/901-online-stock-span/) | *N/A* | *N/A* |  ||
|933| [Number of Recent Calls](https://leetcode.com/problems/number-of-recent-calls/) | [Java](./Algorithms/0933-Number-of-Recent-Calls) | *N/A* | *N/A* |  ||
|2336| [Smallest Number in Infinite Set](https://leetcode.com/problems/smallest-number-in-infinite-set/) | [Java](./Algorithms/2336-smallest-number-in-infinite-set/) | *N/A* | *N/A* |  ||
### Queue
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|225| [Implement Stack using Queues](https://leetcode.com/problems/implement-stack-using-queues/) | [Java](./Algorithms/0225-implement-stack-using-queues/) | *N/A* | *N/A* |  ||
|232| [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/) | [Java](./Algorithms/0232-implement-queue-using-stacks/) | *N/A* | *N/A* |  ||
|239| [Sliding Window Maximum](https://leetcode.com/problem/sliding-window-maximum/) | [Java](./Algorithms/0239-Sliding-Window-Maximum/) | *O(n)* | *O(k)* |  ||
|387| [First Unique Character in a String](https://leetcode.com/problems/first-unique-character-in-a-string/) | [Java](./Algorithms/0387-First-Unique-Character-in-a-String/) | *N/A* | *N/A* |  ||
|649| [Dota2 Senate](https://leetcode.com/problems/dota2-senate/) | [Java](./Algorithms/0649-Dota2-Senate/) | *N/A* | *N/A* |  ||
|933| [Number of Recent Calls](https://leetcode.com/problems/number-of-recent-calls/) | [Java](./Algorithms/0933-Number-of-Recent-Calls) | *N/A* | *N/A* |  ||
### Stack
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|20| [Valid Parentheses](https://leetcode.com/problems/valid-parentheses/) | [Java](./Algorithms/0020-Valid-Parentheses/) | *N/A* | *N/A* |  ||
|32| [Longest Valid Parentheses](https://leetcode.com/problems/longest-valid-parentheses/) | [Java](./Algorithms/32-Longest-Valid-Parentheses/) | *N/A* | *N/A* |  ||
|42| [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/) | [Java](./Algorithms/42-Trapping-Rain-Water/) | *N/A* | *N/A* |  ||
|84| [Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram/) | [Java](./Algorithms/84-Largest-Rectangle-in-Histogram/) | *N/A* | *N/A* |  ||
|94| [Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/) | [Java](./Algorithms/0094-Binary-Tree-Inorder-Traversal/) | *N/A* | *N/A* |  ||
|114| [Flatten Binary Tree to Linked List](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/) | [Java](./Algorithms/114-Flatten-Binary-Tree-to-Linked-List/) | *N/A* | *N/A* |  ||
|144| [Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/) | [Java](./Algorithms/0144-Binary-Tree-Preorder-Traversal/) | *N/A* | *N/A* |  ||
|145| [Binary Tree Postorder Traversal](https://leetcode.com/problems/binary-tree-postorder-traversal/) | [Java](./Algorithms/0145-Binary-Tree-Postorder-Traversal/) | *N/A* | *N/A* |  ||
|155| [Min Stack](https://leetcode.com/problems/min-stack/) | [Java](./Algorithms/155-Min-Stack/) | *N/A* | *N/A* |  ||
|225| [Implement Stack using Queues](https://leetcode.com/problems/implement-stack-using-queues/) | [Java](./Algorithms/0225-implement-stack-using-queues/) | *N/A* | *N/A* |  ||
|232| [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/) | [Java](./Algorithms/0232-implement-queue-using-stacks/) | *N/A* | *N/A* |  ||
|234| [Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list/) | [Java](./Algorithms/0234-palindrome-linked-list/) | *N/A* | *N/A* |  ||
|394| [Decode String](https://leetcode.com/problems/decode-string/) | [Java](./Algorithms/0394-Decode-String) | *N/A* | *N/A* |  ||
|735| [Asteroid Collision](https://leetcode.com/problems/asteroid-collision/) | [Java](./Algorithms/0735-Asteroid-Collision) | *O(N + k)* | *O(N)* |  ||
|739| [Daily Temperatures](https://leetcode.com/problems/daily-temperatures/) | [Java](./Algorithms/0739-Daily-Temperatures/) | *O(N)* | *O(N)* |  ||
|901| [Online Stock Span](https://leetcode.com/problems/online-stock-span/) | [Java](./Algorithms/901-online-stock-span/) | *N/A* | *N/A* |  ||
|2130| [Leaf Similar Trees](https://leetcode.com/problems/maximum-twin-sum-of-a-linked-list/) | [Java](./Algorithms/2130-Leaf-Similar-Trees/) | *O(N)* | *O(N)* |  ||
|2390| [Removing Stars From a String](https://leetcode.com/problems/removing-stars-from-a-string/) | [Java](./Algorithms/2390-Removing-Stars-From-a-String) | *O(N)* | *O(NlogN)* |  ||
### Monotonic Stack
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|42| [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/) | [Java](./Algorithms/42-Trapping-Rain-Water/) | *N/A* | *N/A* |  ||
|84| [Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram/) | [Java](./Algorithms/84-Largest-Rectangle-in-Histogram/) | *N/A* | *N/A* |  ||
|739| [Daily Temperatures](https://leetcode.com/problems/daily-temperatures/) | [Java](./Algorithms/0739-Daily-Temperatures/) | *O(N)* | *O(N)* |  ||
|901| [Online Stock Span](https://leetcode.com/problems/online-stock-span/) | [Java](./Algorithms/901-online-stock-span/) | *N/A* | *N/A* |  ||
### Monotonic Queue
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|239| [Sliding Window Maximum](https://leetcode.com/problem/sliding-window-maximum/) | [Java](./Algorithms/0239-Sliding-Window-Maximum/) | *O(n)* | *O(k)* |  ||
### Brainteaser
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|292| [Nim Game](https://leetcode.com/problems/nim-game/) | [Java](./Algorithms/0292-nim-game/) | *N/A* | *N/A* |  ||
### Game Theory
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|292| [Nim Game](https://leetcode.com/problems/nim-game/) | [Java](./Algorithms/0292-nim-game/) | *N/A* | *N/A* |  ||
### Sorting
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|15| [3Sum](https://leetcode.com/problems/3Sum/) | [Java](./Algorithms/0015-3Sum/) | *N/A* | *N/A* |  ||
|16| [3Sum Closest](https://leetcode.com/problems/3sum-closest/) | [Java](./Algorithms/0016-3Sum-Closest/) | *N/A* | *N/A* |  ||
|18| [4Sum](https://leetcode.com/problems/4Sum/) | [Java](./Algorithms/0018-4Sum/) | *N/A* | *N/A* |  ||
|49| [Group Anagrams](https://leetcode.com/problems/group-anagrams/) | [Java](./Algorithms/49-Group-Anagrams/) | *N/A* | *N/A* |  ||
|56| [Merge Intervals](https://leetcode.com/problems/merge-intervals/) | [Java](./Algorithms/56-merge-intervals/) | *N/A* | *N/A* |  ||
|75| [Sort Colors](https://leetcode.com/problems/sort-colors/) | [Java](./Algorithms/75-sort-colors/) | *N/A* | *N/A* |  ||
|148| [Sort List](https://leetcode.com/problems/sort-list/) | [Java](./Algorithms/148-Sort-List/) | *N/A* | *N/A* |  ||
|169| [Majority Element](https://leetcode.com/problems/majority-element/) | [Java](./Algorithms/169-majority-element/) | *N/A* | *N/A* |  ||
|215| [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) | [Java](./Algorithms/215-kth-largest-element-in-an-array/) | *N/A* | *N/A* |  ||
|217| [Contains Duplicate](https://leetcode.com/problems/contains-duplicate/) | [Java](./Algorithms/0217-Contains-Duplicate/) | *N/A* | *N/A* |  ||
|242| [Valid Anagram](https://leetcode.com/problems/valid-anagram/) | [Java](./Algorithms/0242-Valid-Anagram/) | *N/A* | *N/A* |  ||
|268| [Missing Number](https://leetcode.com/problems/missing-number/) | [Java](./Algorithms/268-missing-number/) | *N/A* | *N/A* |  ||
|295| [Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/) | [Java](./Algorithms/295-Find-Median-from-Data-Stream/) | *N/A* | *N/A* |  ||
|347| [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/) | [Java](./Algorithms/347-Top-K-Frequent-Elements/) | *N/A* | *N/A* |  ||
|350| [Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/) | [Java](./Algorithms/0350-Intersection-of-Two-Arrays-II/) | *N/A* | *N/A* |  ||
|389| [Find the Difference](https://leetcode.com/problems/find-the-difference/) | [Java](./Algorithms/0389-find-the-difference/) | *N/A* | *N/A* |  ||
|414| [Third Maximum Number](https://leetcode.com/problems/third-maximum-number/) | [Java](./Algorithms/0414-third-maximum-number/) | *N/A* | *N/A* |  ||
|435| [Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals/) | [Java](./Algorithms/435-non-overlapping-intervals/) | *N/A* | *N/A* |  ||
|452| [Minimum Number of Arrows to Burst Balloons](https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/) | [Java](./Algorithms/452-minimum-number-of-arrows-to-burst-balloons/) | *N/A* | *N/A* |  ||
|455| [Assign Cookies](https://leetcode.com/problems/assign-cookies/) | [Java](./Algorithms/0728-assign-cookies/) | *N/A* | *N/A* |  ||
|977| [Squares of a Sorted Array](https://leetcode.com/problems/squares-of-a-sorted-array/) | [Java](./Algorithms/0977-Squares-of-a-Sorted-Array/) | *O(n)* | *O(n)* |  | [View](https://leetcode.com/problems/squares-of-a-sorted-array/solutions/3487514/java-well-detailed-two-pointers-runtime-beats-100-1ms-memory-beats-5774-441mb/) discussion on leetcode |
|1337| [The K Weakest Rows in a Matrix](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/) | [Java](./Algorithms/1337-The-K-Weakest-Rows-in-a-Matrix/) | *O(nlogm)* | *O(n)* |  | [View](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/solutions/3540636/java-comprehensive-t-o-n-logm-s-o-n-runtime-99-58-1ms-memory-11-88-44-5mb/) discussion on leetcode |
|1346| [Check If N and Its Double Exist](https://leetcode.com/problems/check-if-n-and-its-double-exist/) | [Java](./Algorithms/1346-Check-If-N-and-Its-Double-exist/) | *N/A* | *N/A* |  ||
|1385| [Find the Distance Value Between Two Arrays](https://leetcode.com/problems/find-the-distance-value-between-two-arrays/) | [Java](./Algorithms/1385-Find-the-Distance-Value-Between-Two-Arrays/) | *N/A* | *N/A* |  ||
|1491| [Average Salary Excluding the Minimum and Maximum Salary](https://leetcode.com/problems/average-salary-excluding-the-minimum-and-maximum-salary/) | [Java](./Algorithms/1491-Average-Salary-Excluding-the-Minimum-Salary-and-Maximum-Salary/) | *N/A* | *N/A* |  ||
|1608| [Special Array With X Elements Greater Than or Equal X](https://leetcode.com/problems/special-array-with-x-elements-greater-than-or-equal-x/) | [Java](./Algorithms/1608-Special-Array-With-X-Elements-Greater-Than-or-Equal-X/) | *O(nlogn)* | *O(1)* |  | [View](https://leetcode.com/problems/special-array-with-x-elements-greater-than-or-equal-x/solutions/3540474/java-easy-to-understand-t-o-nlogn-s-o-1-runtime-100-0ms-memory-54-55-40-4mb/) discussion on leetcode |
|1657| [Determine if Two Strings Are Close](https://leetcode.com/problems/determine-if-two-strings-are-close) | [Java](./Algorithms/1657-Determine-if-Two-Strings-Are-Closed) | *O(N)* | *O(1)* |  ||
|1679| [Max Number of K-Sum Pairs](https://leetcode.com/problems/max-number-of-k-sum-pairs) | [Java](./Algorithms/1679-Max-Number-of-K-Sum-Pairs) | *O(N)* | *O(1)* |  ||
|2300| [Successful Pairs of Spells and Potions](https://leetcode.com/problems/successful-pairs-of-spells-and-potions/) | [Java](./Algorithms/2300-successful-pairs-of-spells-and-potions/) | *N/A* | *N/A* |  ||
|2542| [Maximum Subsequence Score](https://leetcode.com/problems/maximum-subsequence-score/) | [Java](./Algorithms/2542-maximum-subsequence-score/) | *N/A* | *N/A* |  ||
### Prefix Sum
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|238| [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/) | [Java](./Algorithms/0238-Product-of-Array-Except-Self) | *O(N)* | *O(N)* |  ||
|560| [Subarray Sum Equals K](https://leetcode.com/problems/subarray-sum-equals-k/) | [Java](./Algorithms/560-subarray-sum-equals-k/) | *N/A* | *N/A* |  ||
|724| [Find Pivot Index](https://leetcode.com/problems/find-pivot-index/) | [Java](./Algorithms/0724-find-pivot-index/) | *N/A* | *N/A* |  ||
|1004| [Max Consecutive Ones III](https://leetcode.com/problems/max-consecutive-ones-iii/) | [Java](./Algorithms/1004-Max-Consecutive-Ones-III) | *O(N + k)* | *O(1)* |  ||
|1480| [Running Sum of 1D Array](https://leetcode.com/problems/running-sum-of-1d-array/) | [Java](./Algorithms/1480-Running-Sum-of-1D-Array/) | *N/A* | *N/A* |  ||
|1732| [Find the Highest Altitude](https://leetcode.com/problems/find-the-highest-altitude/) | [Java](./Algorithms/1732-Find-the-Highest-Altitude) | *O(N)* | *O(1)* |  ||
### Sliding Window
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|3| [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) | [Java](./Algorithms/0003-Longest-Substring-Without-Repeating-Characters/) | *N/A* | *N/A* |  ||
|76| [Minimum Window Substring](https://leetcode.com/problem/minimum-window-substring/) | [Java](./Algorithms/0105-Minimum-Window-Substring) | *N/A* | *N/A* |  ||
|219| [Contains Duplicate II](https://leetcode.com/problems/contains-duplicate-ii/) | [Java](./Algorithms/0219-Contains-Duplicate-II/) | *O(N)* | *O(N)* |  ||
|239| [Sliding Window Maximum](https://leetcode.com/problem/sliding-window-maximum/) | [Java](./Algorithms/0239-Sliding-Window-Maximum/) | *O(n)* | *O(k)* |  ||
|438| [Find All Anagrams in a String](https://leetcode.com/problems/find-all-anagrams-in-a-string/) | [Java](./Algorithms/438-Find-All-Anagrams-in-a-String/) | *N/A* | *N/A* |  ||
|567| [Permutation in String](https://leetcode.com/problems/permutation-in-string/) | [Java](./Algorithms/0567-Permutation-in-String/) | *N/A* | *N/A* |  ||
|643| [Maximum Average Subarray I](https://leetcode.com/problems/maximum-average-subarray-i/) | [Java](./Algorithms/0643-Maximum-Average-Subarray-I/) | *O(N)* | *O(1)* |  ||
|1004| [Max Consecutive Ones III](https://leetcode.com/problems/max-consecutive-ones-iii/) | [Java](./Algorithms/1004-Max-Consecutive-Ones-III) | *O(N + k)* | *O(1)* |  ||
|1456| [Maximum Number of Vowels in a Substring of Given Length](https://leetcode.com/problems/maximum-number-of-vowels-in-a-substring-of-given-length/) | [Java](./Algorithms/1456-Maximum-Number-of-Vowels-in-a-Substring-of-Given-Length/) | *O(N)* | *O(1)* |  ||
|1493| [Longest Subarray of 1's After Deleting One Element](https://leetcode.com/problems/longest-subarray-of-1s-after-deleting-one-element/) | [Java](./Algorithms/1493-Longest-Subarray-of-1's-After-Deleting-One-Element) | *O(N + k)* | *O(1)* |  ||
### Data Stream
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|295| [Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/) | [Java](./Algorithms/295-Find-Median-from-Data-Stream/) | *N/A* | *N/A* |  ||
|901| [Online Stock Span](https://leetcode.com/problems/online-stock-span/) | [Java](./Algorithms/901-online-stock-span/) | *N/A* | *N/A* |  ||
|933| [Number of Recent Calls](https://leetcode.com/problems/number-of-recent-calls/) | [Java](./Algorithms/0933-Number-of-Recent-Calls) | *N/A* | *N/A* |  ||
### Greedy
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|11| [Container With Most Water](https://leetcode.com/problems/container-with-most-water/) | [Java](./Algorithms/0011-Container-With-Most-Water/) | *N/A* | *N/A* |  ||
|45| [Jump Game II](https://leetcode.com/problems/jump-game-ii/) | [Java](./Algorithms/45-Jump-Game-II/) | *N/A* | *N/A* |  ||
|334| [Increasing Triplet Subsequence](https://leetcode.com/problems/increasing-triplet-subsequence/) | [Java](./Algorithms/0334-Increasing-Triplet-Subsequence/) | *O(N)* | *O(1)* |  ||
|435| [Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals/) | [Java](./Algorithms/435-non-overlapping-intervals/) | *N/A* | *N/A* |  ||
|452| [Minimum Number of Arrows to Burst Balloons](https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/) | [Java](./Algorithms/452-minimum-number-of-arrows-to-burst-balloons/) | *N/A* | *N/A* |  ||
|455| [Assign Cookies](https://leetcode.com/problems/assign-cookies/) | [Java](./Algorithms/0728-assign-cookies/) | *N/A* | *N/A* |  ||
|605| [Can Place Flowers](https://leetcode.com/problems/can-place-flowers/) | [Java](./Algorithms/0605-Can-Place-Flowers) | *O(N)* | *O(1)* |  ||
|649| [Dota2 Senate](https://leetcode.com/problems/dota2-senate/) | [Java](./Algorithms/0649-Dota2-Senate/) | *N/A* | *N/A* |  ||
|680| [Valid Palindrome II](https://leetcode.com/problems/valid-palindrome-ii/) | [Java](./Algorithms/0680-Valid-Palindrome-II/) | *N/A* | *N/A* |  ||
|763| [Partition Labels](https://leetcode.com/problems/partition-labels/) | [Java](./Algorithms/763-Partition-Labels/) | *N/A* | *N/A* |  ||
|1323| [Maximum 69 Number](https://leetcode.com/problems/maximum-69-number/) | [Java](./Algorithms/1323-Maximum-69-Number/) | *O(n)* | *O(n)* |  | [View](https://leetcode.com/problems/maximum-69-number/solutions/3485774/java-well-detailed-iteration-runtime-beats-100-0ms-memory-beats-9028-39mb//) discussion on leetcode |
|1855| [Maximum Distance Between a Pair of Values](https://leetcode.com/problems/maximum-distance-between-a-pair-of-values/description/) | [Java](./Algorithms/1855-Maximum-Distance-Between-a-Pair-of-Values) | *N/A* | *N/A* |  ||
|2542| [Maximum Subsequence Score](https://leetcode.com/problems/maximum-subsequence-score/) | [Java](./Algorithms/2542-maximum-subsequence-score/) | *N/A* | *N/A* |  ||
### Graph
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|207| [Course Schedule](https://leetcode.com/problems/course-schedule/) | [Java](./Algorithms/207-Course-Schedule/) | *N/A* | *N/A* |  ||
|399| [Evaluate Division](https://leetcode.com/problems/evaluate-division/) | [Java](./Algorithms/399-evaluate-division/) | *N/A* | *N/A* |  ||
|547| [Number of Provinces](https://leetcode.com/problems/number-of-provinces/) | [Java](./Algorithms/547-number-of-provinces/) | *N/A* | *N/A* |  ||
|841| [Keys and Rooms](https://leetcode.com/problems/keys-and-rooms/) | [Java](./Algorithms/841-keys-and-rooms/) | *N/A* | *N/A* |  ||
|1466| [Reorder Routes to Make All Paths Lead to the City Zero](https://leetcode.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero/) | [Java](./Algorithms/1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero/) | *O(n)* | *O(n)* |  | [View](https://github.com/ladunjexa/the-leetcode/blob/main/Algorithms/1466-Reorder-Routes-to-Make-All-Paths-Lead-to-the-City-Zero/DISCUSSION.md) discussion on leetcode |
### Heap (Priority Queue)
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|23| [Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/) | [Java](./Algorithms/23-Merge-k-Sorted-Lists/) | *N/A* | *N/A* |  ||
|215| [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) | [Java](./Algorithms/215-kth-largest-element-in-an-array/) | *N/A* | *N/A* |  ||
|239| [Sliding Window Maximum](https://leetcode.com/problem/sliding-window-maximum/) | [Java](./Algorithms/0239-Sliding-Window-Maximum/) | *O(n)* | *O(k)* |  ||
|295| [Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/) | [Java](./Algorithms/295-Find-Median-from-Data-Stream/) | *N/A* | *N/A* |  ||
|347| [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/) | [Java](./Algorithms/347-Top-K-Frequent-Elements/) | *N/A* | *N/A* |  ||
|1337| [The K Weakest Rows in a Matrix](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/) | [Java](./Algorithms/1337-The-K-Weakest-Rows-in-a-Matrix/) | *O(nlogm)* | *O(n)* |  | [View](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/solutions/3540636/java-comprehensive-t-o-n-logm-s-o-n-runtime-99-58-1ms-memory-11-88-44-5mb/) discussion on leetcode |
|2336| [Smallest Number in Infinite Set](https://leetcode.com/problems/smallest-number-in-infinite-set/) | [Java](./Algorithms/2336-smallest-number-in-infinite-set/) | *N/A* | *N/A* |  ||
|2462| [Total Cost to Hire K Workers](https://leetcode.com/problems/total-cost-to-hire-k-workers/) | [Java](./Algorithms/2462-total-cost-to-hire-k-workers/) | *N/A* | *N/A* |  ||
|2542| [Maximum Subsequence Score](https://leetcode.com/problems/maximum-subsequence-score/) | [Java](./Algorithms/2542-maximum-subsequence-score/) | *N/A* | *N/A* |  ||
### Quickselect
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|215| [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) | [Java](./Algorithms/215-kth-largest-element-in-an-array/) | *N/A* | *N/A* |  ||
### Shortest Path
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|399| [Evaluate Division](https://leetcode.com/problems/evaluate-division/) | [Java](./Algorithms/399-evaluate-division/) | *N/A* | *N/A* |  ||
### Matrix
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|36| [Valid Sudoku](https://leetcode.com/problems/valid-sudoku/) | [Java](./Algorithms/0036-Valid-Sudoku/) | *O(n2)* | O(1) |  | [View](https://leetcode.com/problems/valid-sudoku/solutions/3485752/java-well-detailed-iteration-runtime-beats-100-1ms-memory-beats-9794-42mb/) discussion on leetcode |
|37| [Sudoku Solver](https://leetcode.com/problems/sudoku-solver/) | [Java](./Algorithms/0037-sudoku-solver/) | *N/A* | *N/A* |  ||
|48| [Rotate Image](https://leetcode.com/problems/rotate-image/) | [Java](./Algorithms/48-Rotate-Image/) | *N/A* | *N/A* |  ||
|64| [Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum/) | [Java](./Algorithms/64-Minimum-Path-Sum/) | *N/A* | *N/A* |  ||
|73| [Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes/) | [Java](./Algorithms/73-Set-Matrix-Zeroes/) | *N/A* | *N/A* |  ||
|74| [Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/) | [Java](./Algorithms/0074-search-a-2d-matrix/) | *N/A* | *N/A* |  | [View](https://leetcode.com/problems/search-a-2d-matrix/solutions/3525974/java-easy-to-understand-olog-mn-runtime-beats-100-0ms-memory-beats-3613-425mb/) discussion on leetcode |
|79| [Word Search](https://leetcode.com/problems/word-search/) | [Java](./Algorithms/79-word-search/) | *N/A* | *N/A* |  ||
|200| [Number of Islands](https://leetcode.com/problems/number-of-islands/) | [Java](./Algorithms/200-Number-of-Islands/) | *N/A* | *N/A* |  ||
|240| [Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/) | [Java](./Algorithms/240-Search-a-2D-Matrix-II/) | *N/A* | *N/A* |  ||
|542| [01 Matrix](https://leetcode.com/problems/01-matrix/) | [Java](./Algorithms/0542-01-Matrix/) | *O(nm)* | *O(nm)* |  | [View](https://leetcode.com/problems/01-matrix/solutions/3532337/java-easy-to-understand-dynamic-programming-t-s-o-n-m/) discussion on leetcode |
|695| [Max Area of Island](https://leetcode.com/problems/max-area-of-island/) | [Java](./Algorithms/0695-Max-Area-of-Island/) | *N/A* | *N/A* |  ||
|733| [Flood Fill](https://leetcode.com/problems/flood-fill/) | [Java](./Algorithms/0733-Flood-Fill/) | *N/A* | *N/A* |  ||
|867| [Transpose Matrix](https://leetcode.com/problems/transpose-matrix/) | [Java](./Algorithms/0867-Transpose-Matrix/) | *N/A* | *N/A* |  ||
|994| [Rotting Oranges](https://leetcode.com/problems/rotting-oranges/) | [Java](./Algorithms/0994-Rotting-Oranges/) | *N/A* | *N/A* |  ||
|1337| [The K Weakest Rows in a Matrix](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/) | [Java](./Algorithms/1337-The-K-Weakest-Rows-in-a-Matrix/) | *O(nlogm)* | *O(n)* |  | [View](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/solutions/3540636/java-comprehensive-t-o-n-logm-s-o-n-runtime-99-58-1ms-memory-11-88-44-5mb/) discussion on leetcode |
|1351| [Count Negative Numbers in a Sorted Matrix](https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/) | [Java](./Algorithms/1351-Count-Negative-Numbers-in-a-Sorted-Matrix/) | *N/A* | *N/A* |  ||
|1572| [Matrix Diagonal Sum](https://leetcode.com/problems/matrix-diagonal-sum/) | [Java](./Algorithms/1572-Matrix-Diagonal-Sum/) | *O(n)* | *O(1)* |  | [View](https://leetcode.com/problems/matrix-diagonal-sum/solutions/3502477/java-well-detailed-iteration-runtime-beats-100-0ms-memory-beats-45-40-42-8mb/) discussion on leetcode |
|1672| [Richest Customer Wealth](https://leetcode.com/problems/richest-customer-wealth/) | [Java](./Algorithms/1672-Richest-Customer-Wealth/) | *N/A* | *N/A* |  ||
|2352| [Equal Row and Column Pairs](https://leetcode.com/problems/equal-row-and-column-pairs/) | [Java](./Algorithms/2352-Equal-Row-and-Column-Pairs) | *O(N^3)* | *O(1)* |  ||
|1926| [Nearest Exit from Entrance in Maze](https://leetcode.com/problems/nearest-exit-from-entrance-in-maze/) | [Java](./Algorithms/1926-nearest-exit-from-entrance-in-maze/) | *N/A* | *N/A* |  ||
### Simulation
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|67| [Add Binary](https://leetcode.com/problems/add-binary/) | [Java](./Algorithms/0067-Add-Binary/) | *N/A* | *N/A* |  ||
|258| [Add Digits](https://leetcode.com/problems/add-digits/) | [Java](./Algorithms/0258-add-digits/) | *N/A* | *N/A* |  ||
|412| [Fizz Buzz](https://leetcode.com/problems/fizz-buzz/) | [Java](./Algorithms/0412-Fizz-Buzz/) | *N/A* | *N/A* |  ||
|867| [Transpose Matrix](https://leetcode.com/problems/transpose-matrix/) | [Java](./Algorithms/0867-Transpose-Matrix/) | *N/A* | *N/A* |  ||
|2352| [Equal Row and Column Pairs](https://leetcode.com/problems/equal-row-and-column-pairs/) | [Java](./Algorithms/2352-Equal-Row-and-Column-Pairs) | *O(N^3)* | *O(1)* |  ||
|2390| [Removing Stars From a String](https://leetcode.com/problems/removing-stars-from-a-string/) | [Java](./Algorithms/2390-Removing-Stars-From-a-String) | *O(N)* | *O(NlogN)* |  ||
|2462| [Total Cost to Hire K Workers](https://leetcode.com/problems/total-cost-to-hire-k-workers/) | [Java](./Algorithms/2462-total-cost-to-hire-k-workers/) | *N/A* | *N/A* |  ||
|2660| [Determine the Winner of a Bowling Game](https://leetcode.com/problems/determine-the-winner-of-a-bowling-game/) | [Java](./Algorithms/2660-Determine-the-Winner-of-a-Bowling-Game/), [Python](./Algorithms/2660-Determine-the-Winner-of-a-Bowling-Game/Solution.py), [JavaScript](./Algorithms/2660-Determine-the-Winner-of-a-Bowling-Game/Solution.js) | *O(n)* | *O(1)* |  | [View](https://leetcode.com/problems/determine-the-winner-of-a-bowling-game/solutions/3485713/java-python-js-explained-iteration-runtime-beats-99-91-2ms-memory-beats-68-42-7mb/) discussion on leetcode |
### Dynamic Programming
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|5| [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/) | [Java](./Algorithms/0005-Longest-Palindromic-Substring/) | *N/A* | *N/A* |  ||
|22| [Generate Parentheses](https://leetcode.com/problems/generate-parentheses/) | [Java](./Algorithms/0022-Generate-Parentheses/) | *N/A* | *N/A* |  ||
|32| [Longest Valid Parentheses](https://leetcode.com/problems/longest-valid-parentheses/) | [Java](./Algorithms/32-Longest-Valid-Parentheses/) | *N/A* | *N/A* |  ||
|42| [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/) | [Java](./Algorithms/42-Trapping-Rain-Water/) | *N/A* | *N/A* |  ||
|45| [Jump Game II](https://leetcode.com/problems/jump-game-ii/) | [Java](./Algorithms/45-Jump-Game-II/) | *N/A* | *N/A* |  ||
|53| [Maximum Subarray](https://leetcode.com/problems/maximum-subarray/) | [Java](./Algorithms/0053-Maximum-Subarray/) | *N/A* | *N/A* |  ||
|62| [Unique Paths](https://leetcode.com/problems/unique-paths/) | [Java](./Algorithms/62-unique-paths/) | *N/A* | *N/A* |  | [View](https://leetcode.com/problems/unique-paths/solutions/3703926/java-easy-to-understand-dp-recursion-t-s-complexity-o-m-n-best-case/) discussion on leetcode |
|64| [Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum/) | [Java](./Algorithms/64-Minimum-Path-Sum/) | *N/A* | *N/A* |  ||
|70| [Climbing Stairs](https://leetcode.com/problems/climbing-stairs/) | [Java](./Algorithms/0070-Climbing-Stairs/) | *N/A* | *N/A* |  ||
|72| [Edit Distance](https://leetcode.com/problems/edit-distance/) | [Java](./Algorithms/72-edit-distance/) | *N/A* | *N/A* |  ||
|121| [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | [Java](./Algorithms/0121-Best-Time-to-Buy-and-Sell-Stock/) | *N/A* | *N/A* |  ||
|118| [Pascal's Triangle](https://leetcode.com/problems/pascals-triangle/) | [Java](./Algorithms/0118-Pascal's-Triangle/) | *O(n^2)* | *O(n^2)* |  | [View](https://leetcode.com/problems/pascals-triangle/solutions/3514078/java-well-detailed-dp-runtime-beats-94-22-1ms-memory-beats-35-49-42-4mb/) discussion on leetcode |
|119| [Pascal's Triangle II](https://leetcode.com/problems/pascals-triangle-II/) | [Java](./Algorithms/0119-Pascal's-Triangle-II/) | *O(n)* | *O(n)* |  | [View](https://leetcode.com/problems/pascals-triangle-ii/solutions/3514150/java-naive-sophisticated-solutions-runtime-beats-100-0ms-memory-beats-80-5-40-2mb/) discussion on leetcode |
|121| [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | [Java](./Algorithms/121-best-time-to-buy-and-sell-stock/) | *N/A* | *N/A* |  ||
|124| [Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum/) | [Java](./Algorithms/124-binary-tree-maximum-path-sum/) | *N/A* | *N/A* |  ||
|131| [Palindrome Partitioning](https://leetcode.com/problems/palindrome-partitioning/) | [Java](./Algorithms/131-palindrome-partitioning/) | *N/A* | *N/A* |  ||
|139| [Word Break](https://leetcode.com/problems/word-break/) | [Java](./Algorithms/139-Word-Break/) | *N/A* | *N/A* |  ||
|152| [Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/) | [Java](./Algorithms/152-Maximum-Product-Subarray/) | *N/A* | *N/A* |  ||
|198| [House Robber](https://leetcode.com/problems/house-robber/) | [Java](./Algorithms/0198-House-Robber) | *O(N)* | *O(N)* |  ||
|279| [Perfect Squares](https://leetcode.com/problems/perfect-squares/) | [Java](./Algorithms/279-Perfect-Squares/) | *N/A* | *N/A* |  ||
|300| [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/) | [Java](./Algorithms/300-Longest-Increasing-Subsequence/) | *N/A* | *N/A* |  ||
|322| [Coin Change](https://leetcode.com/problems/coin-change/) | [Java](./Algorithms/322-Coin-Change/) | *N/A* | *N/A* |  ||
|338| [Counting Bits](https://leetcode.com/problems/counting-bits/) | [Java](./Algorithms/0338-counting-bits/) | *N/A* | *N/A* |  ||
|392| [Is Subsequence](https://leetcode.com/problems/is-subsequence/) | [Java](./Algorithms/0392-Is-Subsequence) | *N/A* | *N/A* |  ||
|416| [Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/) | [Java](./Algorithms/416-Partition-Equal-Subset-Sum/) | *N/A* | *N/A* |  ||
|435| [Non-overlapping Intervals](https://leetcode.com/problems/non-overlapping-intervals/) | [Java](./Algorithms/435-non-overlapping-intervals/) | *N/A* | *N/A* |  ||
|542| [01 Matrix](https://leetcode.com/problems/01-matrix/) | [Java](./Algorithms/0542-01-Matrix/) | *O(nm)* | *O(nm)* |  | [View](https://leetcode.com/problems/01-matrix/solutions/3532337/java-easy-to-understand-dynamic-programming-t-s-o-n-m/) discussion on leetcode |
|746| [Min Cost Climbing Stairs](https://leetcode.com/problems/min-cost-climbing-stairs/) | [Java](./Algorithms/746-min-cost-climbing-stairs/) | *N/A* | *N/A* |  ||
|790| [Domino and Tromino Tiling](https://leetcode.com/problems/domino-and-tromino-tiling/) | [Java](./Algorithms/790-domino-and-tromino-tiling/) | *N/A* | *N/A* |  ||
|1137| [N-th Tribonacci Number](https://leetcode.com/problems/n-th-tribonacci-number/) | [Java](./Algorithms/1137-N-th-Tribonacci-Number) | *N/A* | *N/A* |  ||
|1143| [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence/) | [Java](./Algorithms/1143-longest-common-subsequence/) | *N/A* | *N/A* |  ||
|1372| [Longest ZigZag Path in a Binary Tree](https://leetcode.com/problems/longest-zigzag-path-in-a-binary-tree/) | [Java](./Algorithms/1372-longest-zigzag-path-in-a-binary-tree/) | *N/A* | *N/A* |  ||
|1493| [Longest Subarray of 1's After Deleting One Element](https://leetcode.com/problems/longest-subarray-of-1s-after-deleting-one-element/) | [Java](./Algorithms/1493-Longest-Subarray-of-1's-After-Deleting-One-Element) | *O(N + k)* | *O(1)* |  ||
|1863| [Sum of All Subset XOR Totals](https://leetcode.com/problems/sum-of-all-subsets-xor-totals/) | [Java](./Algorithms/1863-Sum-of-All-Subset-XOR-Totals/) | *N/A* | *N/A* |  ||
### Divide and Conquer
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|4| [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/) | [Java](./Algorithms/0004-Median-of-Two-Sorted-Arrays/) | *N/A* | *N/A* |  ||
|23| [Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/) | [Java](./Algorithms/23-Merge-k-Sorted-Lists/) | *N/A* | *N/A* |  ||
|53| [Maximum Subarray](https://leetcode.com/problems/maximum-subarray/) | [Java](./Algorithms/0053-Maximum-Subarray/) | *N/A* | *N/A* |  ||
|105| [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) | [Java](./Algorithms/105-construct-binary-tree-from-preorder-and-inorder-traversal/) | *N/A* | *N/A* |  ||
|108| [Convert Sorted Array to Binary Search Tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/) | [Java](./Algorithms/0108-Convert-Sorted-Array-to-Binary-Search-Tree/) | *N/A* | *N/A* |  ||
|148| [Sort List](https://leetcode.com/problems/sort-list/) | [Java](./Algorithms/148-Sort-List/) | *N/A* | *N/A* |  ||
|169| [Majority Element](https://leetcode.com/problems/majority-element/) | [Java](./Algorithms/169-majority-element/) | *N/A* | *N/A* |  ||
|190| [Reverse Bits](https://leetcode.com/problems/reverse-bits/) | [Java](./Algorithms/0190-Reverse-Bits/) | *N/A* | *N/A* |  ||
|191| [Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits/) | [Java](./Algorithms/0191-Number-of-1-Bits/) | *N/A* | *N/A* |  ||
|215| [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) | [Java](./Algorithms/215-kth-largest-element-in-an-array/) | *N/A* | *N/A* |  ||
|240| [Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/) | [Java](./Algorithms/240-Search-a-2D-Matrix-II/) | *N/A* | *N/A* |  ||
|347| [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/) | [Java](./Algorithms/347-Top-K-Frequent-Elements/) | *N/A* | *N/A* |  ||
### Memoization
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|70| [Climbing Stairs](https://leetcode.com/problems/climbing-stairs/) | [Java](./Algorithms/0070-Climbing-Stairs/) | *N/A* | *N/A* |  ||
|139| [Word Break](https://leetcode.com/problems/word-break/) | [Java](./Algorithms/139-Word-Break/) | *N/A* | *N/A* |  ||
|1137| [N-th Tribonacci Number](https://leetcode.com/problems/n-th-tribonacci-number/) | [Java](./Algorithms/1137-N-th-Tribonacci-Number) | *N/A* | *N/A* |  ||
### Trie
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|14| [Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix/) | [Java](./Algorithms/0014-Longest-Common-Prefix/) | *N/A* | *N/A* |  ||
|139| [Word Break](https://leetcode.com/problems/word-break/) | [Java](./Algorithms/139-Word-Break/) | *N/A* | *N/A* |  ||
|208| [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/) | [Java](./Algorithms/0208-Implement-Trie-(Prefix-Tree)) | *N/A* | *N/A* |  ||
|1268| [Search Suggestions System](https://leetcode.com/problems/search-suggestions-system/) | [Java](./Algorithms/1268-search-suggestions-system/) | *N/A* | *N/A* |  ||
### Math
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|2| [Add Two Numbers](https://leetcode.com/problems/add-two-numbers/) | [Java](./Algorithms/0002-Add-Two-Numbers/) | *N/A* | *N/A* |  ||
|7| [Reverse Integer](https://leetcode.com/problems/reverse-integer/) | [Java](./Algorithms/0007-Reverse-Integer/) | *N/A* | *N/A* |  ||
|9| [Palindrome Number](https://leetcode.com/problems/palindrome-number/) | [Java](./Algorithms/0009-Palindrome-Number/) | *N/A* | *N/A* |  ||
|12| [Integer to Roman](https://leetcode.com/problems/integer-to-roman/) | [Java](./Algorithms/0012-Integer-to-Roman/) | *N/A* | *N/A* |  ||
|13| [Roman to Integer](https://leetcode.com/problems/roman-to-integer/) | [Java](./Algorithms/0013-Roman-to-Integer/) | *N/A* | *N/A* |  ||
|48| [Rotate Image](https://leetcode.com/problems/rotate-image/) | [Java](./Algorithms/48-Rotate-Image/) | *N/A* | *N/A* |  ||
|50| [Pow(x, n)](https://leetcode.com/problems/powx-n/) | [Java](./Algorithms/0050-Pow/) | *N/A* | *N/A* |  ||
|62| [Unique Paths](https://leetcode.com/problems/unique-paths/) | [Java](./Algorithms/62-unique-paths/) | *N/A* | *N/A* |  | [View](https://leetcode.com/problems/unique-paths/solutions/3703926/java-easy-to-understand-dp-recursion-t-s-complexity-o-m-n-best-case/) discussion on leetcode |
|66| [Plus One](https://leetcode.com/problems/plus-one/) | [Java](./Algorithms/0066-Plus-One/) | *N/A* | *N/A* |  ||
|67| [Add Binary](https://leetcode.com/problems/add-binary/) | [Java](./Algorithms/0067-Add-Binary/) | *N/A* | *N/A* |  ||
|69| [Sqrt(x)](https://leetcode.com/problems/sqrtx/) | [Java](./Algorithms/0069-Sqrt/) | *N/A* | *N/A* |  ||
|70| [Climbing Stairs](https://leetcode.com/problems/climbing-stairs/) | [Java](./Algorithms/0070-Climbing-Stairs/) | *N/A* | *N/A* |  ||
|168| [Excel Sheet Column Title](https://leetcode.com/problems/excel-sheet-column-title/) | [Java](./Algorithms/0168-excel-sheet-column-title/) | *N/A* | *N/A* |  ||
|171| [Excel Sheet Column Title](https://leetcode.com/problems/excel-sheet-column-number/) | [Java](./Algorithms/0171-Excel-Sheet-Column-Number/) | *O(n)* | *O(1)* |  ||
|189| [Rotate Array](https://leetcode.com/problems/rotate-array/) | [Java](./Algorithms/0189-Rotate-Array/) | *N/A* | *O(1)* |  | [View](https://leetcode.com/problems/rotate-array/solutions/3487654/java-explained-array-manipulation-runtime-beats-100-0ms-memory-beats-23-2-58-9mb/) discussion on leetcode |
|202| [Happy Number](https://leetcode.com/problems/happy-number/) | [Java](./Algorithms/0202-Happy-Number/) | *O(k∗logn)* | *O(k)* |  | [View](https://leetcode.com/problems/happy-number/solutions/3485979/java-well-detailed-recursion-runtime-beats-100-0ms-memory-beats-8286-396mb/) discussion on leetcode |
|231| [Power of Two](https://leetcode.com/problems/power-of-two/) | [Java](./Algorithms/0231-Power-of-Two/) | *N/A* | *N/A* |  ||
|258| [Add Digits](https://leetcode.com/problems/add-digits/) | [Java](./Algorithms/0258-add-digits/) | *N/A* | *N/A* |  ||
|263| [Ugly Number](https://leetcode.com/problems/ugly-number/) | [Java](./Algorithms/0263-Ugly-Number/) | *N/A* | *N/A* |  ||
|268| [Missing Number](https://leetcode.com/problems/missing-number/) | [Java](./Algorithms/268-missing-number/) | *N/A* | *N/A* |  ||
|279| [Perfect Squares](https://leetcode.com/problems/perfect-squares/) | [Java](./Algorithms/279-Perfect-Squares/) | *N/A* | *N/A* |  ||
|292| [Nim Game](https://leetcode.com/problems/nim-game/) | [Java](./Algorithms/0292-nim-game/) | *N/A* | *N/A* |  ||
|326| [Power of Three](https://leetcode.com/problems/power-of-three/) | [Java](./Algorithms/0326-Power-of-Three/) | *O(log3n)* | *O(log3n)* |  | [View](https://leetcode.com/problems/power-of-three/solutions/3485834/java-well-detailed-recursion-runtime-beats-999-1ms-memory-beats-6246-424mb/) discussion on leetcode |
|342| [Power of Four](https://leetcode.com/problems/power-of-four/) | [Java](./Algorithms/0342-Power-of-Four/) | *N/A* | *N/A* |  ||
|367| [Valid Perfect Square](https://leetcode.com/problems/valid-perfect-square/) | [Java](./Algorithms/0367-Valid-Perfect-Square/) | *N/A* | *N/A* |  ||
|412| [Fizz Buzz](https://leetcode.com/problems/fizz-buzz/) | [Java](./Algorithms/0412-Fizz-Buzz/) | *N/A* | *N/A* |  ||
|441| [Arranging Coins](https://leetcode.com/problems/arranging-coins/) | [Java](./Algorithms/0441-arranging-coins/) | *O(logn)* | *O(1)* |  ||
|633| [Sum of Square Numbers](https://leetcode.com/problems/sum-of-square-numbers/) | [Java](./Algorithms/0633-Sum-of-Square-Numbers/) | *O(n)* | *O(1)* |  ||
|728| [Self Dividing Numbers](https://leetcode.com/problems/self-dividing-numbers/) | [Java](./Algorithms/0728-self-dividing-numbers/) | *N/A* | *N/A* |  ||
|1137| [N-th Tribonacci Number](https://leetcode.com/problems/n-th-tribonacci-number/) | [Java](./Algorithms/1137-N-th-Tribonacci-Number) | *N/A* | *N/A* |  ||
|1323| [Maximum 69 Number](https://leetcode.com/problems/maximum-69-number/) | [Java](./Algorithms/1323-Maximum-69-Number/) | *O(n)* | *O(n)* |  | [View](https://leetcode.com/problems/maximum-69-number/solutions/3485774/java-well-detailed-iteration-runtime-beats-100-0ms-memory-beats-9028-39mb//) discussion on leetcode |
|1342| [Number of Steps to Reduce a Number to Zero](https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/) | [Java](./Algorithms/1342-Number-of-Steps-to-Reduce-a-Number-to-Zero/) | *N/A* | *N/A* |  ||
|1822| [Sign of the Product of an Array](https://leetcode.com/problems/sign-of-the-product-of-an-array/) | [Java](./Algorithms/1822-Sign-of-the-Product-of-an-Array/) | *N/A* | *N/A* |  ||
|1863| [Sum of All Subset XOR Totals](https://leetcode.com/problems/sum-of-all-subsets-xor-totals/) | [Java](./Algorithms/1863-Sum-of-All-Subset-XOR-Totals/) | *N/A* | *N/A* |  ||
### Tree
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|94| [Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/) | [Java](./Algorithms/0094-Binary-Tree-Inorder-Traversal/) | *N/A* | *N/A* |  ||
|98| [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/) | [Java](./Algorithms/0098-Validate-Binary-Search-Tree/) | *N/A* | *N/A* |  ||
|100| [Same Tree](https://leetcode.com/problems/same-tree/) | [Java](./Algorithms/0100-Same-Tree/) | *N/A* | *N/A* |  ||
|101| [Symmetric Tree](https://leetcode.com/problems/symmetric-tree/) | [Java](./Algorithms/0101-Symmetric-Tree/) | *N/A* | *N/A* |  ||
|102| [Valid Anagram](https://leetcode.com/problems/binary-tree-level-order-traversal/) | [Java](./Algorithms/0102-Binary-Tree-Level-Order-Traversal/) | *N/A* | *N/A* |  ||
|104| [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/) | [Java](./Algorithms/0104-Maximum-Depth-of-Binary-Tree/) | *N/A* | *N/A* |  ||
|105| [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) | [Java](./Algorithms/105-construct-binary-tree-from-preorder-and-inorder-traversal/) | *N/A* | *N/A* |  ||
|108| [Convert Sorted Array to Binary Search Tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/) | [Java](./Algorithms/0108-Convert-Sorted-Array-to-Binary-Search-Tree/) | *N/A* | *N/A* |  ||
|110| [Balanced Binary Tree](https://leetcode.com/problems/balanced-binary-tree/) | [Java](./Algorithms/0110-Balanced-Binary-Tree/) | *N/A* | *N/A* |  ||
|111| [Minimum Depth of Binary Tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/) | [Java](./Algorithms/0111-Minimum-Depth-of-Binary-Tree/) | *N/A* | *N/A* |  ||
|114| [Flatten Binary Tree to Linked List](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/) | [Java](./Algorithms/114-Flatten-Binary-Tree-to-Linked-List/) | *N/A* | *N/A* |  ||
|116| [Populating Next Right Pointers in Each Node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/) | [Java](./Algorithms/0116-Populating-Next-Right-Pointers-in-Each-Node/) | *N/A* | *N/A* |  ||
|124| [Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum/) | [Java](./Algorithms/124-binary-tree-maximum-path-sum/) | *N/A* | *N/A* |  ||
|144| [Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/) | [Java](./Algorithms/0144-Binary-Tree-Preorder-Traversal/) | *N/A* | *N/A* |  ||
|145| [Binary Tree Postorder Traversal](https://leetcode.com/problems/binary-tree-postorder-traversal/) | [Java](./Algorithms/0145-Binary-Tree-Postorder-Traversal/) | *N/A* | *N/A* |  ||
|199| [Binary Tree Right Side View](https://leetcode.com/problems/binary-tree-right-side-view/) | [Java](./Algorithms/199-binary-tree-right-side-view/) | *N/A* | *N/A* |  ||
|226| [Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree/) | [Java](./Algorithms/0226-Invert-Binary-Tree/) | *N/A* | *N/A* |  ||
|230| [Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst/) | [Java](./Algorithms/230-kth-smallest-element-in-a-bst/) | *N/A* | *N/A* |  ||
|235| [Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/) | [Java](./Algorithms/0235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree) | *O(logn)* | *O(logn)* |  | [View](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/solutions/3551611/java-easy-to-understand-recursion-t-s-complexity-o-log-n/) discussion on leetcode |
|236| [Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/) | [Java](./Algorithms/236-lowest-common-ancestor-of-a-binary-tree/) | *N/A* | *N/A* |  ||
|257| [Binary Tree Paths](https://leetcode.com/problems/binary-tree-paths/) | [Java](./Algorithms/0257-binary-tree-paths/) | *N/A* | *N/A* |  ||
|404| [Sum of Left Leaves](https://leetcode.com/problems/sum-of-left-leaves/) | [Java](./Algorithms/0404-Sum-of-Left-Leaves/) | *N/A* | *N/A* |  ||
|437| [Path Sum III](https://leetcode.com/problems/path-sum-iii/) | [Java](./Algorithms/437-path-sum-iii/) | *N/A* | *N/A* |  ||
|450| [Delete Node in a BST](https://leetcode.com/problems/delete-node-in-a-bst/) | [Java](./Algorithms/0450-Delete-Node-in-a-BST) | *N/A* | *N/A* |  ||
|543| [Diameter of Binary Tree](https://leetcode.com/problems/diameter-of-binary-tree/) | [Java](./Algorithms/543-diameter-of-binary-tree/) | *N/A* | *N/A* |  ||
|617| [Merge Two Binary Trees](https://leetcode.com/problems/merge-two-binary-trees/) | [Java](./Algorithms/0617-Merge-Two-Binary-Trees/) | *N/A* | *N/A* |  ||
|653| [Two Sum IV - Input is a BST](https://leetcode.com/problems/two-sum-iv-input-is-a-bst/) | [Java](./Algorithms/0653-Two-Sum-IV-Input-is-a-BST/) | *N/A* | *N/A* |  ||
|700| [Search in a Binary Search Tree](https://leetcode.com/problems/search-in-a-binary-search-tree/) | [Java](./Algorithms/0700-Search-in-a-Binary-Search-Tree/) | *N/A* | *N/A* |  ||
|701| [Insert into a Binary Search Tree](https://leetcode.com/problems/insert-into-a-binary-search-tree/) | [Java](./Algorithms/0701-Insert-into-a-Binary-Search-Tree/) | *N/A* | *N/A* |  ||
|872| [Leaf Similar Trees](https://leetcode.com/problems/leaf-similar-trees/) | [Java](./Algorithms/0872-Leaf-Similar-Trees) | *N/A* | *N/A* |  ||
|1161| [Maximum Level Sum of a Binary Tree](https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/) | [Java](./Algorithms/1161-maximum-level-sum-of-a-binary-tree/) | *N/A* | *N/A* |  ||
|1372| [Longest ZigZag Path in a Binary Tree](https://leetcode.com/problems/longest-zigzag-path-in-a-binary-tree/) | [Java](./Algorithms/1372-longest-zigzag-path-in-a-binary-tree/) | *N/A* | *N/A* |  ||
|1448| [Count Good Nodes in Binary Tree](https://leetcode.com/problems/count-good-nodes-in-binary-tree/) | [Java](./Algorithms/1448-count-good-nodes-in-binary-tree/) | *N/A* | *N/A* |  ||
### Binary Search
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|4| [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/) | [Java](./Algorithms/0004-Median-of-Two-Sorted-Arrays/) | *N/A* | *N/A* |  ||
|33| [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/description/) | [Java](./Algorithms/0033-Search-in-Rotated-Sorted-Array) | *N/A* | *N/A* |  ||
|34| [Find First and Last Position of Element in Sorted Array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/) | [Java](./Algorithms/0034-Find-First-and-Last-Position-of-Element-in-Sorted-Array/) | *O(logn)* | *O(1)* |  ||
|35| [Search Insert Position](https://leetcode.com/problems/search-insert-position/) | [Java](./Algorithms/0035-Search-Insert-Position/) | *N/A* | *N/A* |  | [View](https://leetcode.com/problems/search-insert-position/solutions/3487362/java-well-detailed-logarithmic-runtime-beats-100-0ms-memory-beats-4898-423mb/) discussion on leetcode |
|69| [Sqrt(x)](https://leetcode.com/problems/sqrtx/) | [Java](./Algorithms/0069-Sqrt/) | *N/A* | *N/A* |  ||
|74| [Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/) | [Java](./Algorithms/0074-search-a-2d-matrix/) | *N/A* | *N/A* |  | [View](https://leetcode.com/problems/search-a-2d-matrix/solutions/3525974/java-easy-to-understand-olog-mn-runtime-beats-100-0ms-memory-beats-3613-425mb/) discussion on leetcode |
|153| [Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/) | [Java](./Algorithms/0153-Find-Minimum-In-Rotated-Sorted-Array) | *N/A* | *N/A* |  ||
|162| [Find Peak Element](https://leetcode.com/problems/find-peak-element/) | [Java](./Algorithms/162-find-peak-element/) | *N/A* | *N/A* |  ||
|240| [Search a 2D Matrix II](https://leetcode.com/problems/search-a-2d-matrix-ii/) | [Java](./Algorithms/240-Search-a-2D-Matrix-II/) | *N/A* | *N/A* |  ||
|268| [Missing Number](https://leetcode.com/problems/missing-number/) | [Java](./Algorithms/268-missing-number/) | *N/A* | *N/A* |  ||
|278| [First Bad Version](https://leetcode.com/problems/first-bad-version/) | [Java](./Algorithms/0278-First-Bad-Version/) | *O(logn)* | *O(1)* |  | [View](https://leetcode.com/problems/first-bad-version/solutions/3487302/java-well-detailed-logarithmic-runtime-beats-9604-16ms-memory-beats-8579-392mb/) discussion on leetcode |
|287| [Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number/) | [Java](./Algorithms/287-find-the-duplicate-number/) | *N/A* | *N/A* |  ||
|300| [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/) | [Java](./Algorithms/300-Longest-Increasing-Subsequence/) | *N/A* | *N/A* |  ||
|350| [Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/) | [Java](./Algorithms/0350-Intersection-of-Two-Arrays-II/) | *N/A* | *N/A* |  ||
|367| [Valid Perfect Square](https://leetcode.com/problems/valid-perfect-square/) | [Java](./Algorithms/0367-Valid-Perfect-Square/) | *N/A* | *N/A* |  ||
|374| [Guess Number Higher or Lower](https://leetcode.com/problems/guess-number-higher-or-lower/) | [Java](./Algorithms/0374-Guess-Number-Higher-or-Lower/) | *O(logn)* | *O(1)* |  ||
|441| [Arranging Coins](https://leetcode.com/problems/arranging-coins/) | [Java](./Algorithms/0441-arranging-coins/) | *O(logn)* | *O(1)* |  ||
|450| [Delete Node in a BST](https://leetcode.com/problems/delete-node-in-a-bst/) | [Java](./Algorithms/0450-Delete-Node-in-a-BST) | *N/A* | *N/A* |  ||
|633| [Sum of Square Numbers](https://leetcode.com/problems/sum-of-square-numbers/) | [Java](./Algorithms/0633-Sum-of-Square-Numbers/) | *O(n)* | *O(1)* |  ||
|704| [Binary Search](https://leetcode.com/problems/binary-search/) | [Java](./Algorithms/0704-Binary-Search/Solution.java), [Python](./Algorithms/0704-Binary-Search/Solution.py), [C#](./Algorithms/0704-Binary-Search/Solution.cs), [JavaScript](./Algorithms/0704-Binary-Search/Solution.js), [TypeScript](./Algorithms/0704-Binary-Search/Solution.ts) | *O(logn)* | *O(1)* |  ||
|744| [Find Smallest Letter Greater Than Target](https://leetcode.com/problems/find-smallest-letter-greater-than-target/) | [Java](./Algorithms/0744-Find-Smallest-Letter-Greater-Than-Target/) | *N/A* | *N/A* |  ||
|852| [Peak Index in a Mountain Array](https://leetcode.com/problems/peak-index-in-a-mountain-array/) | [Java](./Algorithms/0852-Peak-Index-in-a-Mountain-Array/) | *O(logn)* | *O(1)* |  ||
|875| [Koko Eating Bananas](https://leetcode.com/problems/koko-eating-bananas/) | [Java](./Algorithms/875-koko-eating-bananas/) | *N/A* | *N/A* |  ||
|1004| [Max Consecutive Ones III](https://leetcode.com/problems/max-consecutive-ones-iii/) | [Java](./Algorithms/1004-Max-Consecutive-Ones-III) | *O(N + k)* | *O(1)* |  ||
|1337| [The K Weakest Rows in a Matrix](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/) | [Java](./Algorithms/1337-The-K-Weakest-Rows-in-a-Matrix/) | *O(nlogm)* | *O(n)* |  | [View](https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/solutions/3540636/java-comprehensive-t-o-n-logm-s-o-n-runtime-99-58-1ms-memory-11-88-44-5mb/) discussion on leetcode |
|1346| [Check If N and Its Double Exist](https://leetcode.com/problems/check-if-n-and-its-double-exist/) | [Java](./Algorithms/1346-Check-If-N-and-Its-Double-exist/) | *N/A* | *N/A* |  ||
|1351| [Count Negative Numbers in a Sorted Matrix](https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/) | [Java](./Algorithms/1351-Count-Negative-Numbers-in-a-Sorted-Matrix/) | *N/A* | *N/A* |  ||
|1385| [Find the Distance Value Between Two Arrays](https://leetcode.com/problems/find-the-distance-value-between-two-arrays/) | [Java](./Algorithms/1385-Find-the-Distance-Value-Between-Two-Arrays/) | *N/A* | *N/A* |  ||
|1539| [Kth Missing Positive Number](https://leetcode.com/problems/kth-missing-positive-number/) | [Java](./Algorithms/1539-Kth-Missing-Positive-Number/) | *O(logn)* | *O(n)* |  ||
|1608| [Special Array With X Elements Greater Than or Equal X](https://leetcode.com/problems/special-array-with-x-elements-greater-than-or-equal-x/) | [Java](./Algorithms/1608-Special-Array-With-X-Elements-Greater-Than-or-Equal-X/) | *O(nlogn)* | *O(1)* |  | [View](https://leetcode.com/problems/special-array-with-x-elements-greater-than-or-equal-x/solutions/3540474/java-easy-to-understand-t-o-nlogn-s-o-1-runtime-100-0ms-memory-54-55-40-4mb/) discussion on leetcode |
|1855| [Maximum Distance Between a Pair of Values](https://leetcode.com/problems/maximum-distance-between-a-pair-of-values/description/) | [Java](./Algorithms/1855-Maximum-Distance-Between-a-Pair-of-Values) | *N/A* | *N/A* |  ||
|2300| [Successful Pairs of Spells and Potions](https://leetcode.com/problems/successful-pairs-of-spells-and-potions/) | [Java](./Algorithms/2300-successful-pairs-of-spells-and-potions/) | *N/A* | *N/A* |  ||
### Binary Tree
| # | Title | Solution | Time | Space | Difficulty | Note |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
|94| [Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/) | [Java](./Algorithms/0094-Binary-Tree-Inorder-Traversal/) | *N/A* | *N/A* |  ||
|98| [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/) | [Java](./Algorithms/0098-Validate-Binary-Search-Tree/) | *N/A* | *N/A* |  ||
|100| [Same Tree](https://leetcode.com/problems/same-tree/) | [Java](./Algorithms/0100-Same-Tree/) | *N/A* | *N/A* |  ||
|101| [Symmetric Tree](https://leetcode.com/problems/symmetric-tree/) | [Java](./Algorithms/0101-Symmetric-Tree/) | *N/A* | *N/A* |  ||
|102| [Valid Anagram](https://leetcode.com/problems/binary-tree-level-order-traversal/) | [Java](./Algorithms/0102-Binary-Tree-Level-Order-Traversal/) | *N/A* | *N/A* |  ||
|104| [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/) | [Java](./Algorithms/0104-Maximum-Depth-of-Binary-Tree/) | *N/A* | *N/A* |  ||
|105| [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/) | [Java](./Algorithms/105-construct-binary-tree-from-preorder-and-inorder-traversal/) | *N/A* | *N/A* |  ||
|108| [Convert Sorted Array to Binary Search Tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/) | [Java](./Algorithms/0108-Convert-Sorted-Array-to-Binary-Search-Tree/) | *N/A* | *N/A* |  ||
|110| [Balanced Binary Tree](https://leetcode.com/problems/balanced-binary-tree/) | [Java](./Algorithms/0110-Balanced-Binary-Tree/) | *N/A* | *N/A* |  ||
|111| [Minimum Depth of Binary Tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/) | [Java](./Algorithms/0111-Minimum-Depth-of-Binary-Tree/) | *N/A* | *N/A* |  ||
|114| [Flatten Binary Tree to Linked List](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/) | [Java](./Algorithms/114-Flatten-Binary-Tree-to-Linked-List/) | *N/A* | *N/A* |  ||
|116| [Populating Next Right Pointers in Each Node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/) | [Java](./Algorithms/0116-Populating-Next-Right-Pointers-in-Each-Node/) | *N/A* | *N/A* |  ||
|124| [Binary Tree Maximum Path Sum](https://leetcode.com/problems/binary-tree-maximum-path-sum/) | [Java](./Algorithms/124-binary-tree-maximum-path-sum/) | *N/A* | *N/A* |  ||
|144| [Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/) | [Java](./Algorithms/0144-Binary-Tree-Preorder-Traversal/) | *N/A* | *N/A* |  ||
|145| [Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-postorder-traversal/) | [Java](./Algorithms/0145-Binary-Tree-Postorder-Traversal/) | *N/A* | *N/A* |  ||
|199| [Binary Tree Right Side View](https://leetcode.com/problems/binary-tree-right-side-view/) | [Java](./Algorithms/199-binary-tree-right-side-view/) | *N/A* | *N/A* |  ||
|226| [Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree/) | [Java](./Algorithms/0226-Invert-Binary-Tree/) | *N/A* | *N/A* |  ||
|230| [Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst/) | [Java](./Algorithms/230-kth-smallest-element-in-a-bst/) | *N/A* | *N/A* |  ||
|235| [Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/) | [Java](./Algorithms/0235-Lowest-Common-Ancestor-of-a-Binary-Search-Tree) | *O(logn)* | *O(logn)* |  | [View](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/solutions/3551611/java-easy-to-understand-recursion-t-s-complexity-o-log-n/) discussion on leetcode |
|236| [Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/) | [Java](./Algorithms/236-lowest-common-ancestor-of-a-binary-tree/) | *N/A* | *N/A* |  ||
|257| [Binary Tree Paths](https://leetcode.com/problems/binary-tree-paths/) | [Java](./Algorithms/0257-binary-tree-paths/) | *N/A* | *N/A* |  ||
|404| [Sum of Left Leaves](https://leetcode.com/problems/sum-of-left-leaves/) | [Java](./Algorithms/0404-Sum-of-Left-Leaves/) | *N/A* | *N/A* |  ||
|437| [Path Sum III](https://leetcode.com/problems/path-sum-iii/) | [Java](./Algorithms/437-path-sum-iii/) | *N/A* | *N/A* |  ||
|450| [Delete Node in a BST](https://leetcode.com/problems/delete-node-in-a-bst/) | [Java](./Algorithms/0450-Delete-Node-in-a-BST) | *N/A* | *N/A* |  ||
|543| [Diameter of Binary Tree](https://leetcode.com/problems/diameter-of-binary-tree/) | [Java](./Algorithms/543-diameter-of-binary-tree/) | *N/A* | *N/A* |  ||
|617| [Merge Two Binary Trees](https://leetcode.com/problems/merge-two-binary-trees/) | [Java](./Algorithms/0617-Merge-Two-Binary-Trees/) | *N/A* | *N/A* |  ||
|653| [Two Sum IV - Input is a BST](https://leetcod