Algorithm and data structure solutions in Java 8 / JavaScript.
*: LintCode | **: HackerRank | ***: GeeksforGeeks
- Array
- String
- Binary Tree
- Binary Search
- Linked List
- HashMap
- Queue
- Heap
- Two Pointers
- Math
- Bit Manipulation
- Breadth-First Search
- Depth-First Search
- Backtracking
- Stack
- Dynamic Programming
- Sort
- Greedy
- Graph
- Trie
- Union Find
- Design
Title | Solution | Difficulty |
---|---|---|
004. Median of Two Sorted Arrays | Solution | Hard |
029. Divide Two Integers | Solution | Medium |
033. Search in Rotated Sorted Array | Solution | Medium |
034. Find First and Last Position of Element in Sorted Array | Solution | Medium |
035. Search Insert Position | Solution | Easy |
050. Pow(x, n) | Solution | Medium |
069. Sqrt(x) | Solution | Easy |
074. Search a 2D Matrix | Solution | Medium |
162. Find Peak Element | Solution | Medium |
240. Search a 2D Matrix II | Solution | Medium |
300. Longest Increasing Subsequence | Solution | Medium |
367. Valid Perfect Square | Solution | Easy |
Title | Solution | Difficulty |
---|---|---|
002. Add Two Numbers | Solution | Medium |
019. Remove Nth Node From End of List | Solution | Medium |
021. Merge Two Sorted Lists | Solution | Easy |
024. Swap Nodes in Pairs | Solution | Medium |
023. Merge k Sorted Lists | Solution | Hard |
061. Rotate List | Solution | Medium |
083. Remove Duplicates from Sorted List | Solution | Easy |
141. Linked List Cycle | Solution | Easy |
146. LRU Cache | Solution | Hard |
148. Sort List | Solution | Medium |
160. Intersection of Two Linked Lists | Solution | Easy |
206. Reverse Linked List | Solution | Easy |
234. Palindrome Linked List | Solution | Easy |
369. Plus One Linked List | Solution | Medium |
**Delete Node Greater than X | Solution | Easy |
**Merge in Between.java | Solution | Easy |
Title | Solution | Difficulty |
---|---|---|
102. Binary Tree Level Order Traversal | Solution | Medium |
207. Course Schedule | Java | Medium |
239. Sliding Window Maximum | Solution | Hard |
582. Kill Process | Solution | Medium |
Title | Solution | Difficulty |
---|---|---|
215. Kth Largest Element in an Array | Solution | Medium |
347. Top K Frequent Elements | Solution | Medium |
373. Find K Pairs with Smallest Sums | Solution | Medium |
378. Kth Smallest Element in a Sorted Matrix | Solution | Medium |
632. Smallest Range | Solution | Hard |
642. Design Search Autocomplete System | Solution | Hard |
692. Top K Frequent Words | Solution | Medium |
703. Kth Largest Element in a Stream | Solution | Easy |
759. Employee Free Time | Solution | Hard |
Title | Solution | Difficulty |
---|---|---|
007. Reverse Integer | Solution | Easy |
008. String to Integer (atoi) | Solution | Medium |
009. Palindrome Number | Solution | Easy |
012. Integer to Roman | Solution | Medium |
013. Roman to Integer | Solution | Easy |
029. Divide Two Integers | Solution | Medium |
050. Pow(x, n) | Solution | Medium |
136. Single Number | Solution | Easy |
166. Fraction to Recurring Decimal | Solution | Medium |
168. Excel Sheet Column Title | Solution | Easy |
224. Basic Calculator I | Java | Hard |
231. Power of Two | Solution | Easy |
258. Add Digits | Solution | Easy |
268. Missing Number | Solution | Easy |
273. Integer to English Words | Solution | Hard |
279. Perfect Squares | Solution | Medium |
326. Power of Three | Solution | Easy |
342. Power of Four | Solution | Easy |
441. Arranging Coins | Solution | Easy |
507. Perfect Number | Solution | Easy |
633. Sum of Square Numbers | Solution | Easy |
781. Rabbits in Forest | Solution | Medium |
829. Consecutive Numbers Sum | Solution | Hard |
Title | Solution | Difficulty |
---|---|---|
231. Power of Two | Solution | Easy |
751. IP to CIDR | Solution | Easy |
Title | Solution | Difficulty |
---|---|---|
116. Populating Next Right Pointers in Each Node | Solution | Medium |
126. Word Ladder II | Solution | Hard |
127. Word Ladder | Solution | Medium |
128. Longest Consecutive Sequence | Solution | Hard |
130. Surrounded Regions | Solution | Medium |
200. Number of Islands | Solution | Medium |
210. Course Schedule II | Solution | Medium |
269. Alien Dictionary | Solution | Hard |
329. Longest Increasing Path in a Matrix | Solution | Hard |
490. The Maze | Solution | Medium |
695. Max Area of Island | Solution | Easy |
773. Sliding Puzzle | Solution | Hard |
787. Cheapest Flights Within K Stops | [Solution] | |
(./LeetCode/787_Cheapest_Flights_Within_K_Stops.java) | Medium | |
815. Bus Routes | Solution | Hard |
Title | Solution | Difficulty |
---|---|---|
101. Symmetric Tree | Solution | Easy |
105. Construct Binary Tree from Preorder and Inorder Traversal | Solution | Medium |
108. Convert Sorted Array to Binary Search Tree | Solution | Easy |
126. Word Ladder II | Solution | Hard |
131. Palindrome Partitioning | Solution | Medium |
756. Pyramid Transition Matrix | Solution | Medium |
490. The Maze | Solution | Medium |
Title | Solution | Difficulty |
---|---|---|
017. Letter Combinations of a Phone Number | Solution | Medium |
022. Generate Parentheses | Solution | Medium |
039. Combination Sum | Solution | Medium |
046. Permutations | Solution | Medium |
047. Permutations II | Solution | Medium |
131. Palindrome Partitioning | Solution | Medium |
140. Word Break II | Solution | Hard |
212. Word Search II | Solution | Hard |
Title | Solution | Difficulty |
---|---|---|
032. Longest Valid Parentheses | Solution | Hard |
094. Binary Tree Inorder Traversal | Solution | Medium |
103. Binary Tree Zigzag Level Order Traversal | Solution | Medium |
144. Binary Tree Preorder Traversal | Solution | Medium |
150. Evaluate Reverse Polish Notation | Solution | Medium |
155. Min Stack | Solution | Easy |
173. Binary Search Tree Iterator | Solution | Medium |
316. Remove Duplicate Letters | Solution | Hard |
341. Flatten Nested List Iterator | Solution | Medium |
739. Daily Temperatures | Solution | Medium |
**Implement Stack By LinkedList | Solution | Easy |
Title | Solution | Difficulty |
---|---|---|
005. Longest Palindromic Substring | Solution | Medium |
010. Regular Expression Matching | Solution | Hard |
055. Jump Game | Solution | Medium |
062. Unique Paths | Solution | Medium |
064. Minimum Path Sum | Solution | Medium |
070. Climbing Stairs | Solution | Easy |
072. Edit Distance | Solution | Hard |
091. Decode Ways | Solution | Medium |
120. Triangle | Solution | Medium |
131. Palindrome Partitioning | Solution | Medium |
139. Word Break | Solution | Medium |
140. Word Break II | Solution | Hard |
152. Maximum Product Subarray | Solution | Medium |
198. House Robber | Solution | Easy |
213. House Robber II | Solution | Medium |
221. Maximal Square | Solution | Medium |
224. Basic Calculator I | Java | Hard |
279. Perfect Squares | Solution | Medium |
312. Burst Balloons | Solution | Hard |
329. Longest Increasing Path in a Matrix | Solution | Hard |
647. Palindromic Substrings | Solution | Medium |
688. Knight Probability in Chessboard | Solution | Medium |
746. Min Cost Climbing Stairs | Solution | Easy |
*109. Triangle | Solution | Easy |
Title | Solution | Difficulty |
---|---|---|
023. Merge k Sorted Lists | Solution | Hard |
049. Group Anagrams | Solution | Medium |
056. Merge Intervals | Solution | Medium |
148. Sort List | Solution | Medium |
179. Largest Number | Solution | Medium |
218. The Skyline Problem | Solution | Hard |
252. Meeting Rooms | Solution | Easy |
253. Meeting Rooms II | Solution | Medium |
280. Wiggle Sort | Solution | Medium |
295. Find Median from Data Stream | Solution | Hard |
324. Wiggle Sort II | Solution | Hard |
*464. Sort Integers II | Solution | Easy |
Title | Solution | Difficulty |
---|---|---|
045. Jump Game II | Solution | Hard |
134. Gas Station | Solution | Medium |
406. Queue Reconstruction by Height | Solution | Medium |
765. Couples Holding Hands | Solution | Hard |
787. Cheapest Flights Within K Stops | Solution | Medium |
Title | Solution | Difficulty |
---|---|---|
133. Clone Graph | Solution | Medium |
207. Course Schedule | Java | Medium |
210. Course Schedule II | Solution | Medium |
269. Alien Dictionary | Solution | Hard |
582. Kill Process | Solution | Medium |
Title | Solution | Difficulty |
---|---|---|
208. Implement Trie (Prefix Tree) | Solution | Medium |
421. Maximum XOR of Two Numbers in an Array) | Solution | Medium |
642. Design Search Autocomplete System | Solution | Hard |
Title | Solution | Difficulty |
---|---|---|
211. Add and Search Word - Data structure design | Solution | Medium |
212. Word Search II | Solution | Hard |
261. Graph Valid Tree | Solution | Medium |
305. Number of Islands II | Solution | Hard |
425. Word Squares | Solution | Hard |
684. Redundant Connection | Solution | Medium |
721. Accounts Merge | Solution | Medium |
737. Sentence Similarity II | Solution | Medium |
765. Couples Holding Hands | Solution | Hard |
*589. Connecting Graph | Solution | Medium |
*590. Connecting Graph II | Solution | Medium |
*591. Connecting Graph III | Solution | Medium |
Title | Solution | Difficulty |
---|---|---|
380. Insert Delete GetRandom O(1) | Solution | Medium |
642. Design Search Autocomplete System | Solution | Hard |
**Friends Graph | Solution | Easy |
MIT