leetcode

I started solving questions on leetcode since Aug, 2018 and only listed the problems I solved twice. More questions will be updated for sure and they can be found at my github repository Algorithm-and-Leetcode

  • 1.Two Sum

  • 10. Regular Expression Matching

  • 100. Same Tree


  • 101. Symmetric Tree


  • 102. Binary Tree Level Order Traversal


  • 103. Binary Tree Zigzag Level Order Traversal


  • 104. Maximum Depth of Binary Tree


  • 105. Construct Binary Tree from Preorder and Inorder Traversal


  • 106. Construct Binary Tree from Inorder and Postorder Traversal


  • 107. Binary Tree Level Order Traversal II


  • 108. Convert Sorted Array to Binary Search Tree


  • 109. Convert Sorted List to Binary Search Tree


  • 11. Container With Most Water

  • 110. Balanced Binary Tree


  • 111. Minimum Depth of Binary Tree


  • 112. Path Sum


  • 113. Path Sum II


  • 114. Flatten Binary Tree to Linked List


  • 115. Distinct Subsequences


  • 116. Populating Next Right Pointers in Each Node


  • 117. Populating Next Right Pointers in Each Node II


  • 118. Pascal's Triangle


  • 119. Pascal's Triangle II


  • 12. Integer to Roman

  • 120. Triangle


  • 121. Best Time to Buy and Sell Stock


  • 122. Best Time to Buy and Sell Stock II


  • 123. Best Time to Buy and Sell Stock III


  • 124. Binary Tree Maximum Path Sum


  • 125. Valid Palindrome


  • 126. Word Ladder II


  • 127. Word Ladder


  • 128. Longest Consecutive Sequence


  • 129. Sum Root to Leaf Numbers


  • 13. Roman to Integer

  • 130. Surrounded Regions


  • 131. Palindrome Partitioning


  • 132. Palindrome Partitioning II


  • 133. Clone Graph


  • 134. Gas Station


  • 136. Single Number


  • 137. Single Number II


  • 138. Copy List with Random Pointer


  • 139. Word Break


  • 14. Longest Common Prefix

  • 140. Word Break II


  • 141. Linked List Cycle


  • 142. Linked List Cycle II


  • 143. Reorder List


  • 144. Binary Tree Preorder Traversal


  • 145. Binary Tree Postorder Traversal


  • 146. LRU Cache


  • 147. Insertion Sort List


  • 148. Sort List


  • 149. Max Points on a Line


  • 15. 3Sum

  • 150. Evaluate Reverse Polish Notation


  • 151. Reverse Words in a String


  • 152. Maximum Product Subarray


  • 153. Find Minimum in Rotated Sorted Array


  • 154. Find Minimum in Rotated Sorted Array II


  • 155. Min Stack


  • 157. Read N Characters Given Read4


  • 158. Read N Characters Given Read4 II - Call multiple times


  • 16. 3Sum Closest

  • 160. Intersection of Two Linked Lists


  • 162. Find Peak Element


  • 164. Maximum Gap


  • 165. Compare Version Numbers


  • 166. Fraction to Recurring Decimal


  • 167. Two Sum II - Input array is sorted


  • 168. Excel Sheet Column Title


  • 169. Majority Element


  • 17. Letter Combinations of a Phone Number

  • 170. Two Sum III - Data structure design


  • 171. Excel Sheet Column Number


  • 172. Factorial Trailing Zeroes


  • 173. Binary Search Tree Iterator


  • 174. Dungeon Game


  • 175. Combine Two Tables


  • 176. Second Highest Salary


  • 177. Nth Highest Salary


  • 178. Rank Scores


  • 179. Largest Number


  • 18. 4Sum

  • 180. Consecutive Numbers


  • 181. Employees Earning More Than Their Managers


  • 182. Duplicate Emails


  • 183. Customers Who Never Order


  • 184. Department Highest Salary


  • 185. Department Top Three Salaries


  • 187. Repeated DNA Sequences


  • 189. Rotate Array


  • 19. Remove Nth Node From End of List


  • 190. Reverse Bits


  • 191. Number of 1 Bits


  • 198. House Robber


  • 199. Binary Tree Right Side View


  • 2. Add Two Numbers


  • 20. Valid Parentheses


  • 200. Number of Islands


  • 201. Bitwise AND of Numbers Range


  • 202. Happy Number


  • 203. Remove Linked List Elements


  • 204. Count Primes


  • 205. Isomorphic Strings


  • 206. Reverse Linked List


  • 207. Course Schedule


  • 208. Implement Trie (Prefix Tree)


  • 209. Minimum Size Subarray Sum


  • 21. Merge Two Sorted Lists


  • 210. Course Schedule II


  • 211. Add and Search Word - Data structure design


  • 212. Word Search II


  • 213. House Robber II


  • 214. Shortest Palindrome


  • 215. Kth Largest Element in an Array


  • 216. Combination Sum III


  • 217. Contains Duplicate


  • 219. 496. Next Greater Element I


  • 219. Contains Duplicate II


  • 22. Generate Parentheses


  • 220. Contains Duplicate III


  • 221. Maximal Square


  • 222. Count Complete Tree Nodes


  • 223. Rectangle Area


  • 224. Basic Calculator


  • 225. Implement Stack using Queues


  • 226. Invert Binary Tree


  • 227. Basic Calculator II


  • 228. Summary Ranges


  • 229. Majority Element II


  • 23. Merge k Sorted Lists


  • 230. Kth Smallest Element in a BST


  • 231. Power of Two


  • 232. Implement Queue using Stacks


  • 234. Palindrome Linked List


  • 235. Lowest Common Ancestor of a Binary Search Tree


  • 236. Lowest Common Ancestor of a Binary Tree


  • 237. Delete Node in a Linked List


  • 238. Product of Array Except Self


  • 239. Sliding Window Maximum


  • 24. Swap Nodes in Pairs


  • 240. Search a 2D Matrix II


  • 241. Different Ways to Add Parentheses


  • 242. Valid Anagram


  • 25. Reverse Nodes in k-Group


  • 250. Count Univalue Subtrees


  • 252. Meeting Rooms


  • 253. Meeting Rooms II


  • 257. Binary Tree Paths


  • 258. Add Digits


  • 26. Remove Duplicates from Sorted Array


  • 261. Graph Valid Tree


  • 263. Ugly Number


  • 264. Ugly Number II


  • 268. Missing Number


  • 269. Alien Dictionary


  • 27. Remove Element


  • 270. Closest Binary Search Tree Value


  • 273. Integer to English Words


  • 274. H-Index


  • 275. H-Index II


  • 276. Paint Fence


  • 277. Find the Celebrity


  • 278. First Bad Version


  • 279. Perfect Squares


  • 28. Implement strStr()


  • 280. Wiggle Sort


  • 282. Expression Add Operators


  • 283. Move Zeroes


  • 284. Peeking Iterator


  • 285. Inorder Successor in BST


  • 285. Inorder Successor in BST


  • 287. Find the Duplicate Number


  • 289. Game of Life


  • 29. Divide Two Integers


  • 290. Word Pattern


  • 292. Nim Game


  • 295.Find Median from Data Stream


  • 297. Serialize and Deserialize Binary Tree


  • 299. Bulls and Cows


  • 3. Longest Substring Without Repeating Characters


  • 30. Substring with Concatenation of All Words


  • 300. Longest Increasing Subsequence


  • 301. Remove Invalid Parentheses


  • 303. Range Sum Query - Immutable


  • 304. Range Sum Query 2D - Immutable


  • 305. Number Of Island II


  • 306. Additive Number


  • 307. Range Sum Query - Mutable


  • 309. Best Time to Buy and Sell Stock with Cooldown


  • 31. Next Permutation


  • 310. Minimum Height Trees


  • 312. Burst Balloons


  • 313. Super Ugly Number


  • 314. Binary Tree Vertical Order Traversal


  • 315. Count of Smaller Numbers After Self


  • 316. Remove Duplicate Letters


  • 318. Maximum Product of Word Lengths


  • 319. Bulb Switcher


  • 32. Longest Valid Parentheses


  • 322. Coin Change


  • 324. Wiggle Sort II


  • 325. Maximum Size Subarray Sum Equals k


  • 328. Odd Even Linked List


  • 329. Longest Increasing Path in a Matrix


  • 33. Search in Rotated Sorted Array


  • 331. Verify Preorder Serialization of a Binary Tree


  • 332. Reconstruct Itinerary


  • 334. Increasing Triplet Subsequence


  • 336. Palindrome Pairs


  • 337. House Robber III


  • 338. Counting Bits


  • 339. Nested List Weight Sum


  • 34. Find First and Last Position of Element in Sorted Array


  • 340. Longest Substring with At Most K Distinct Characters


  • 341. Flatten Nested List Iterator


  • 342. Power of Four


  • 343. Integer Break


  • 344. Reverse String


  • 345. Reverse Vowels of a String


  • 346. Moving Average from Data Stream


  • 347. Top K Frequent Elements


  • 348. Design Tic-Tac-Toe


  • 349. Intersection of Two Arrays


  • 35. Search Insert Position


  • 350. Intersection of Two Arrays II


  • 355. Design Twitter


  • 357. Count Numbers with Unique Digits


  • 36. Valid Sudoku


  • 360. Sort Transfromed Array


  • 362. Design Hit Counter


  • 364. Nested List Weight Sum II


  • 37. Sudoku Solver


  • 377. Combination Sum IV


  • 378. Kth Smallest Element in a Sorted Matrix


  • 38. Count and Say


  • 380. Insert Delete GetRandom O(1)


  • 382. Linked List Random Node


  • 382. Linked List Random Node


  • 387. First Unique Character in a String


  • 39. Combination Sum


  • 392. Is Subsequence


  • 393. UTF-8 Validation


  • 394. Decode String


  • 395. Longest Substring with At Least K Repeating Characters


  • 399. Evaluate Division


  • 4. Median of Two Sorted Arrays


  • 40. Combination Sum II


  • 41. First Missing Positive


  • 410. Split Array Largest Sum


  • 412. Fizz Buzz


  • 416. Partition Equal Subset Sum


  • 42. Trapping Rain Water


  • 426. Convert Binary Search Tree to Sorted Doubly Linked List


  • 427. Construct Quad Tree


  • 429. N-ary Tree Level Order Traversal


  • 43. Multiply Strings


  • 435. Non-overlapping Intervals


  • 437. Path Sum III


  • 438. Find All Anagrams in a String


  • 44. Wildcard Matching


  • 443. String Compression


  • 445. Add Two Numbers II


  • 448. Find All Numbers Disappeared in an Array


  • 449. Serialize and Deserialize BST


  • 45. Jump Game II


  • 450. Delete Node in a BST


  • 452. Minimum Number of Arrows to Burst Balloons


  • 458. Poor Pigs


  • 458. Poor Pigs


  • 46. Permutations


  • 460. LFU Cache


  • 468. Validate IP Address


  • 47. Permutations II


  • 48. Rotate Image


  • 489. Robot Room Cleaner


  • 49. Group Anagrams


  • 490. The Maze


  • 494. Target Sum


  • 5. Longest Palindromic Substring


  • 50. Pow(x, n)


  • 501. Find Mode in Binary Search Tree


  • 503. Next Greater Element II


  • 505. The Maze II


  • 508. Most Frequent Subtree Sum


  • 509. Fibonacci Number


  • 51. N-Queens


  • 518. Coin Change 2


  • 52. N-Queens II


  • 528. Random Pick with Weight


  • 529. Minesweeper


  • 53. Maximum Subarray


  • 530. Minimum Absolute Difference in BST


  • 535. Encode and Decode TinyURL


  • 54. Spiral Matrix


  • 542. 01 Matrix


  • 543. Diameter of Binary Tree


  • 546. Remove Boxes


  • 547. Friend Circles


  • 55. Jump Game


  • 56. Merge Intervals


  • 564. Find the Closest Palindrome


  • 57. Insert Interval


  • 572. Subtree of Another Tree


  • 576. Out of Boundary Paths


  • 58. Length of Last Word


  • 583. Delete Operation for Two Strings


  • 589. N-ary Tree Preorder Traversal


  • 59. Spiral Matrix II


  • 590. N-ary Tree Postorder Traversal


  • 6. ZigZag Conversion


  • 60. Permutation Sequence


  • 609. Find Duplicate File in System


  • 61. Rotate List


  • 617. Merge Two Binary Trees


  • 62. Unique Paths


  • 621. Task Scheduler


  • 63. Unique Paths II


  • 635. Design Log Storage System


  • 636. Exclusive Time of Functions


  • 637. Average of Levels in Binary Tree


  • 64. Minimum Path Sum


  • 642. Design Search Autocomplete System


  • 647. Palindromic Substrings


  • 648. Replace Words


  • 65. Valid Number


  • 653. Two Sum IV - Input is a BST


  • 654. Maximum Binary Tree


  • 66. Plus One


  • 664. Strange Printer


  • 668. Kth Smallest Number in Multiplication Table


  • 669. Trim a Binary Search Tree


  • 67. Add Binary


  • 673. Number of Longest Increasing Subsequence


  • 675. Cut Off Trees for Golf Event


  • 676. Implement Magic Dictionary


  • 677. Map Sum Pairs


  • 679. 24 Game


  • 68. Text Justification


  • 683. K Empty Slots


  • 684. Redundant Connection


  • 685. Redundant Connection II


  • 687. Longest Univalue Path


  • 688. Knight Probability in Chessboard


  • 69. Sqrt(x)


  • 692. Top K Frequent Words


  • 695. Max Area of Island


  • 698. Partition to K Equal Sum Subsets


  • 7. Reverse Integer


  • 70. Climbing Stairs


  • 700. Search in a Binary Search Tree


  • 701. Insert into a Binary Search Tree


  • 704. Binary Search


  • 706. Design HashMap


  • 707. Design Linked List


  • 71. Simplify Path


  • 710. Random Pick with Blacklist


  • 712. Minimum ASCII Delete Sum for Two Strings


  • 716. Max Stack


  • 717. 1-bit and 2-bit Characters


  • 719. Find K-th Smallest Pair Distance


  • 72. Edit Distance


  • 720. Longest Word in Dictionary


  • 721. Accounts Merge


  • 726. Number of Atoms


  • 729. My Calendar I


  • 73. Set Matrix Zeroes


  • 731. My Calendar II


  • 733. Flood Fill


  • 735. Asteroid Collision


  • 74. Search a 2D Matrix


  • 740. Delete and Earn


  • 741. Cherry Pickup


  • 743. Network Delay Time


  • 745. Prefix and Suffix Search


  • 746. Min Cost Climbing Stairs


  • 75. Sort Colors


  • 752. Open the Lock


  • 753. Cracking the Safe


  • 755. Pour Water


  • 759. Employee Free Time


  • 76. Minimum Window Substring


  • 763. Partition Labels


  • 77. Combinations


  • 771. Jewels and Stones


  • 772. Basic Calculator III


  • 773. Sliding Puzzle


  • 778. Swim in Rising Water


  • 78. Subsets


  • 784. Letter Case Permutation


  • 784. Letter Case Permutation


  • 785. Is Graph Bipartite?


  • 786. K-th Smallest Prime Fraction


  • 788. Rotated Digits


  • 79. Word Search


  • 790. Domino and Tromino Tiling


  • 792. Number of Matching Subsequences


  • 8. String to Integer (atoi)


  • 80. Remove Duplicates from Sorted Array II


  • 801. Minimum Swaps To Make Sequences Increasing


  • 802. Find Eventual Safe States


  • 81. Search in Rotated Sorted Array II


  • 811. Subdomain Visit Count


  • 813. Largest Sum of Averages


  • 814. Binary Tree Pruning


  • 815. Bus Routes


  • 818. Race Car


  • 819. Most Common Word


  • 82. Remove Duplicates from Sorted List II


  • 827. Making A Large Island


  • 83. Remove Duplicates from Sorted List


  • 833. Find And Replace in String


  • 836. Rectangle Overlap


  • 839. Similar String Groups


  • 84. Largest Rectangle in Histogram


  • 841. Keys and Rooms


  • 842. Split Array into Fibonacci Sequence


  • 843. Guess the Word


  • 844. Backspace String Compare


  • 847. Shortest Path Visiting All Nodes


  • 85. Maximal Rectangle


  • 850. Rectangle Area II


  • 852. Peak Index in a Mountain Array


  • 856. Score of Parentheses


  • 86. Partition List


  • 864. Shortest Path to Get All Keys


  • 872. Leaf-Similar Trees


  • 875. Koko Eating Bananas


  • 88. Merge Sorted Array


  • 886. Possible Bipartition


  • 89. Gray Code


  • 9. Palindrome Number


  • 90. Subsets II


  • 901. Online Stock Span


  • 904. Fruit Into Baskets


  • 907. Sum of Subarray Minimums


  • 91. Decode Ways


  • 92. Reverse Linked List II


  • 923. 3Sum With Multiplicity


  • 924. Minimize Malware Spread


  • 929. Unique Email Addresses


  • 93. Restore IP Addresses


  • 931. Minimum Falling Path Sum


  • 933. Number of Recent Calls


  • 934. Shortest Bridge


  • 935. Knight Dialer


  • 937. Reorder Log Files


  • 939. Minimum Area Rectangle


  • 94. Binary Tree Inorder Traversal


  • 943. Find the Shortest Superstring


  • 947. Most Stones Removed with Same Row or Column


  • 95. Unique Binary Search Trees II


  • 952. Largest Component Size by Common Factor


  • 957. Prison Cells After N Days


  • 959. Regions Cut By Slashes


  • 96. Unique Binary Search Trees


  • 965. Univalued Binary Tree


  • 968. Binary Tree Cameras


  • 97. Interleaving String


  • 973. K Closest Points to Origin


  • 975. Odd Even Jump


  • 977. Squares of a Sorted Array


  • 979. Distribute Coins in Binary Tree


  • 98. Validate Binary Search Tree


  • 980. Unique Paths III


  • 981. Time Based Key-Value Store


  • 986. Interval List Intersections


  • 987. Vertical Order Traversal of a Binary Tree


  • 990. Satisfiability of Equality Equations


  • 996. Number of Squareful Arrays