https://github.com/arcturuszhang/playedbyleetcode
My leetcode solution repo
https://github.com/arcturuszhang/playedbyleetcode
leetcode solutions
Last synced: 3 months ago
JSON representation
My leetcode solution repo
- Host: GitHub
- URL: https://github.com/arcturuszhang/playedbyleetcode
- Owner: ArcturusZhang
- Created: 2017-11-20T06:20:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-17T15:49:49.000Z (over 6 years ago)
- Last Synced: 2025-03-29T09:32:53.971Z (3 months ago)
- Topics: leetcode, solutions
- Language: Java
- Homepage:
- Size: 589 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Support: SupportUtil/out/artifacts/SupportUtil_jar/SupportUtil.jar
Awesome Lists containing this project
README
# My solutions for LeetCode
I will put my solutions (of course, the accepted ones) of [Leetcode Problems](https://leetcode.com/problemset/algorithms/) in this repo. Every problem will be done in Java.
## Problems
| ID | Problem | Relative Topic |
| --- | :--- | :--- |
| 001 | [Two Sum](https://leetcode.com/problems/two-sum/description/) | Brutal Force, Hash Table |
| 002 | [Add Two Numbers](https://leetcode.com/problems/add-two-numbers/description/) | Integer Addition |
| 003 | [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/description/) | Double Pointers |
| 004 | [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/description/) | Merge Sort |
| 005 | [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring) | Dynamic Programming |
| 006 | [ZigZag Conversion](https://leetcode.com/problems/zigzag-conversion) | Brutal Force |
| 007 | [Reverse Integer](https://leetcode.com/problems/reverse-integer) | Brutal Force |
| 008 | [String to Integer (atoi)](https://leetcode.com/problems/string-to-integer-atoi) | Brutal Force |
| 009 | [Palindrome Number](https://leetcode.com/problems/palindrome-number) | Brutal Force (Reverse Half) |
| 010 | [Regular Expression Matching](https://leetcode.com/problems/regular-expression-matching/description/) | Brutal Force |
| 011 | [Container With Most Water](https://leetcode.com/problems/container-with-most-water) | Greedy |
| 012 | [Integer to Roman](https://leetcode.com/problems/integer-to-roman/description/) | Brutal Force |
| 013 | [Roman to Integer](https://leetcode.com/problems/roman-to-integer/description/) | Brutal Force |
| 014 | [Longest Common Prefix](https://leetcode.com/problems/longest-common-prefix) | Brutal Force, Divide and Conquer (Not Implemented) |
| 015 | [3Sum](https://leetcode.com/problems/3sum) | Binary Search |
| 016 | [3Sum Closest](https://leetcode.com/problems/3sum-closest) | Binary Search |
| 017 | [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number) | Backtracking (DFS) |
| 018 | [4Sum](https://leetcode.com/problems/4sum) | Binary Search |
| 019 | [Remove Nth Node From End of List](https://leetcode.com/problems/remove-nth-node-from-end-of-list/description/) | Double Pointers |
| 020 | [Valid Parentheses](https://leetcode.com/problems/valid-parentheses) | Stack |
| 021 | [Merge Two Sorted Lists](https://leetcode.com/problems/merge-two-sorted-lists) | Merge Sort |
| 022 | [Generate Parentheses](https://leetcode.com/problems/generate-parentheses) | Dynamic Programming |
| 023 | [Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists) | Merge Sort (Using Priority Queue) |
| 024 | [Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs/description/) | Double Pointers, Stack |
| 025 | [Reverse Nodes in k-Group](https://leetcode.com/problems/reverse-nodes-in-k-group/description/) | Stack |
| 026 | [Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/description/) | Brutal Force |
| 027 | [Remove Element](https://leetcode.com/problems/remove-element) | Brutal Force |
| 028 | [Implement strStr()](https://leetcode.com/problems/implement-strstr/description/) | Brutal Force |
| 029 | [Divide Two Integers](https://leetcode.com/problems/divide-two-integers/description/) | Binary Long Division |
| 030 | [Substring with Concatenation of All Words](https://leetcode.com/problems/substring-with-concatenation-of-all-words/description/) | Hash Table |
| 031 | [Next Permutation](https://leetcode.com/problems/next-permutation/description/) | Single Pass Approach |
| 032 | [Longest Valid Parentheses](https://leetcode.com/problems/longest-valid-parentheses/description/) | Stack, Dynamic Programming |
| 033 | [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/description/) | Binary Search |
| 034 | [Search for a Range](https://leetcode.com/problems/search-for-a-range/description/) | Binary Search |
| 035 | [Search Insert Position](https://leetcode.com/problems/search-insert-position/description/) | Brutal Force, Binary Search |
| 036 | [Valid Sudoku](https://leetcode.com/problems/valid-sudoku/description/) | Brutal Force, Hash Table |
| 037 | [Sudoku Solver](https://leetcode.com/problems/sudoku-solver/description/) | Backtracking (DFS) |
| 038 | [Count and Say](https://leetcode.com/problems/count-and-say/description/) | Brutal Force |
| 039 | [Combination Sum](https://leetcode.com/problems/combination-sum/description/) | Backtracking (DFS) |
| 040 | [Combination Sum II](https://leetcode.com/problems/combination-sum-ii/description/) | Backtracking (DFS) |
| 041 | [First Missing Positive](https://leetcode.com/problems/first-missing-positive/description/) | Bucket Sort |
| 043 | [Multiply Strings](https://leetcode.com/problems/multiply-strings/description/) | Integer Long Multiplication |
| 044 | [Wildcard Matching](https://leetcode.com/problems/wildcard-matching/description/) | Brutal Force, Dynamic Programming |
| 046 | [Permutations](https://leetcode.com/problems/permutations/description/) | Backtracking (DFS) |
| 047 | [Permutations II](https://leetcode.com/problems/permutations-ii/description/) | Backtracking (DFS) |
| 048 | [Rotate Image](https://leetcode.com/problems/rotate-image/description/) | Brutal Force |
| 049 | [Group Anagrams](https://leetcode.com/problems/group-anagrams/description/) | Hash Table |
| 050 | [Pow(x, n)](https://leetcode.com/problems/powx-n/description/) | Divide and Conquer |
| 051 | [N-Queens](https://leetcode.com/problems/n-queens/description/) | Backtracking (DFS) |
| 052 | [N-Queens-II](https://leetcode.com/problems/n-queens-ii/description/) | Backtracking (DFS) |
| 053 | [Maximum Subarray](https://leetcode.com/problems/maximum-subarray/description/) | Dynamic Programming |
| 056 | [Merge Intervals](https://leetcode.com/problems/merge-intervals/description/) | Brutal Force |
| 057 | [Insert Interval](https://leetcode.com/problems/insert-interval/description/) | Brutal Force |
| 058 | [Length of Last Word](https://leetcode.com/problems/length-of-last-word/description/) | Brutal Force |
| 060 | [Permutation Sequence](https://leetcode.com/problems/permutation-sequence/description/) | Brutal Force (Reuse 031) |
| 061 | [Rotate List](https://leetcode.com/problems/rotate-list/description/) | Linked List |
| 062 | [Unique Paths](https://leetcode.com/problems/unique-paths/description/) | Dynamic Programming |
| 063 | [Unique Paths II](https://leetcode.com/problems/unique-paths-ii/description/) | Dynamic Programming |
| 064 | [Minimum Path Sum](https://leetcode.com/problems/minimum-path-sum/description/) | Dynamic Programming |
| 065 | [Valid Number](https://leetcode.com/problems/valid-number/description/) | Brutal Force |
| 066 | [Plus One](https://leetcode.com/problems/plus-one/description/) | Integer Addition |
| 067 | [Add Binary](https://leetcode.com/problems/add-binary/description/) | Binary Integer Addition |
| 068 | [Text Justification](https://leetcode.com/problems/text-justification/description/) | Brutal Force |
| 069 | [Sqrt(x)](https://leetcode.com/problems/sqrtx/description/) | Brutal Force, Newton Method |
| 070 | [Climbing Stairs](https://leetcode.com/problems/climbing-stairs/description/) | Dynamic Programming (Fibonacci) |
| 071 | [Simplify Path](https://leetcode.com/problems/simplify-path/description/) | Stack |
| 072 | [Edit Distance](https://leetcode.com/problems/edit-distance/description/) | Dynamic Programming |
| 073 | [Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes/description/) | Hash Table |
| 074 | [Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/description/) | Binary Search |
| 075 | [Sort Colors](https://leetcode.com/problems/sort-colors/discuss/) | Hash Table |
| 076 | [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/description/) | Hash Table |
| 077 | [Combinations](https://leetcode.com/problems/combinations/description/) | Backtracking (DFS) |
| 078 | [Subsets](https://leetcode.com/problems/subsets/description/) | Backtracking (DFS) |
| 079 | [Word Search](https://leetcode.com/problems/word-search/description/) | Backtracking (DFS) |
| 080 | [Remove Duplicates from Sorted Array II](https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/description/) | Brutal Force |
| 082 | [Remove Duplicates from Sorted List II](https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/description/) | Linked List |
| 083 | [Remove Duplicates from Sorted List](https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/) | Linked List |
| 085 | [Maximal Rectangle](https://leetcode.com/problems/maximal-rectangle/description/) | Dynamic Programming |
| 086 | [Partition List](https://leetcode.com/problems/partition-list/description/) | Linked List |
| 087 | [Scramble String](https://leetcode.com/problems/scramble-string/description/) | Dynamic Programming |
| 089 | [Gray Code](https://leetcode.com/problems/gray-code/description/) | Bit Manipulation, Brutal Force |
| 090 | [Subsets II](https://leetcode.com/problems/subsets-ii/description/) | Backtracking (DFS) |
| 091 | [Decode Ways](https://leetcode.com/problems/decode-ways/description/) | Backtracking, Dynamic Programming |
| 092 | [Reverse Linked List II](https://leetcode.com/problems/reverse-linked-list-ii/description/) | Stack |
| 093 | [Restore IP Addresses](https://leetcode.com/problems/restore-ip-addresses/description/) | Backtracking (DFS) |
| 094 | [Binary Tree Inorder Traversal](https://leetcode.com/problems/binary-tree-inorder-traversal/) | Binary Tree Traversal |
| 095 | [Unique Binary Search Trees II](https://leetcode.com/problems/unique-binary-search-trees-ii/description/) | |
| 096 | [Unique Binary Search Trees](https://leetcode.com/problems/unique-binary-search-trees/description/) | Dynamic Programming |
| 098 | [Validate Binary Search Tree](https://leetcode.com/problems/validate-binary-search-tree/description/) | Binary Tree Traversal |
| 099 | [Recover Binary Search Tree](https://leetcode.com/problems/recover-binary-search-tree/description/) | Binary Tree Traversal |
| 100 | [Same Tree](https://leetcode.com/problems/same-tree/description/) | Binary Tree |
| 101 | [Symmetric Tree](https://leetcode.com/problems/symmetric-tree/description/) | Binary Tree |
| 102 | [Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/description/) | Binary Tree Traversal |
| 103 | [Binary Tree Zigzag Level Order Traversal](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/description/) | Binary Tree Traversal |
| 104 | [Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree/description/) | Binary Tree |
| 105 | [Construct Binary Tree from Preorder and Inorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/description/) | Binary Tree Traversal |
| 106 | [Construct Binary Tree from Inorder and Postorder Traversal](https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/description/) | Binary Tree Traversal |
| 107 | [Binary Tree Level Order Traversal II](https://leetcode.com/problems/binary-tree-level-order-traversal-ii/description/) | Binary Tree Traversal |
| 108 | [Convert Sorted Array to Binary Search Tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/) | Binary Tree |
| 109 | [Convert Sorted List to Binary Search Tree](https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree/description/) | Binary Tree & Linked List |
| 110 | [Balanced Binary Tree](https://leetcode.com/problems/balanced-binary-tree/description/) | Binary Tree Traversal |
| 111 | [Minimum Depth of Binary Tree](https://leetcode.com/problems/minimum-depth-of-binary-tree/description/) | Binary Tree Traversal |
| 112 | [Path Sum](https://leetcode.com/problems/path-sum/description/) | Binary Tree |
| 113 | [Path Sum II](https://leetcode.com/problems/path-sum-ii/description/) | Binary Tree & Backtracking (DFS) |
| 114 | [Flatten Binary Tree to Linked List](https://leetcode.com/problems/flatten-binary-tree-to-linked-list/description/) | Binary Tree Traversal |
| 115 | [Distinct Subsequences](https://leetcode.com/problems/distinct-subsequences/description/) | Dynamic Programming |
| 116 | [Populating Next Right Pointers in Each Node](https://leetcode.com/problems/populating-next-right-pointers-in-each-node/discuss/) | Binary Tree & Linked List |
| 117 | [Populating Next Right Pointers in Each Node II](https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/description/) | Binary Tree & Linked List |
| 118 | [Pascal's Triangle](https://leetcode.com/problems/pascals-triangle/description/) | Brutal Force |
| 119 | [Pascal's Triangle II](https://leetcode.com/problems/pascals-triangle-ii/description/) | Brutal Force |
| 120 | [Triangle](https://leetcode.com/problems/triangle/description/) | Dynamic Programming |
| 121 | [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/) | Dynamic Programming |
| 122 | [Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/) | Greedy |
| 123 | [Best Time to Buy and Sell Stock III](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/description/) | Dynamic Programming |
| 125 | [Valid Palindrome](https://leetcode.com/problems/valid-palindrome/description/) | String (Palindrome) |
| 126 | [Word Ladder II](https://leetcode.com/problems/word-ladder-ii/description/) | BFS & DFS, Graph (optimal path) |
| 127 | [Word Ladder](https://leetcode.com/problems/word-ladder/description/) | BFS |
| 128 | [Longest Consecutive Sequence](https://leetcode.com/problems/longest-consecutive-sequence/description/) | Sorting, Hash Table |
| 129 | [Sum Root to Leaf Numbers](https://leetcode.com/problems/sum-root-to-leaf-numbers/description/) | Binary Tree Traversal (DFS) |
| 130 | [Surrounded Regions](https://leetcode.com/problems/surrounded-regions/description/) | DFS |
| 133 | [Clone Graph](https://leetcode.com/problems/clone-graph/description/) | DFS |
| 136 | [Single Number](https://leetcode.com/problems/single-number/description/) | Hash Table, Bit Manipulation |
| 137 | [Single Number II](https://leetcode.com/problems/single-number-ii/description/) | Hash Table, Bit Manipulation |
| 138 | [Copy List with Random Pointer](https://leetcode.com/problems/copy-list-with-random-pointer/description/) | Linked List |
| 139 | [Word Break](https://leetcode.com/problems/word-break/description/) | BFS, Dynamic Programming |
| 140 | [Word Break II](https://leetcode.com/problems/word-break-ii/description/) | cached DFS |
| 141 | [Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/description/) | Double Pointers, Hash Table |
| 142 | [Linked List Cycle II](https://leetcode.com/problems/linked-list-cycle-ii/description/) | Double Pointers |
| 143 | [Reorder List](https://leetcode.com/problems/reorder-list/description/) | Linked List |
| 144 | [Binary Tree Preorder Traversal](https://leetcode.com/problems/binary-tree-preorder-traversal/description/) | Binary Tree Traversal |
| 145 | [Binary Tree Postorder Traversal](https://leetcode.com/problems/binary-tree-postorder-traversal/description/) | Binary Tree Traversal |
| 148 | [Sort List](https://leetcode.com/problems/sort-list/description/) | Merge Sort |
| 149 | [Max Points on a Line](https://leetcode.com/problems/max-points-on-a-line/description/) | Hash table |
| 160 | [Intersection of Two Linked Lists](https://leetcode.com/problems/intersection-of-two-linked-lists/description/) | Hash Table, Linked List |
| 167 | [Two Sum II - Input array is sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/description/) | Binary Search |
| 168 | [Excel Sheet Column Title](https://leetcode.com/problems/excel-sheet-column-title/description/) | Math |
| 169 | [Majority Element](https://leetcode.com/problems/majority-element/description/) | Hash Map |
| 171 | [Excel Sheet Column Number](https://leetcode.com/problems/excel-sheet-column-number/description/) | Math |
| 172 | [Factorial Trailing Zeroes](https://leetcode.com/problems/factorial-trailing-zeroes/description/) | Math |
| 173 | [Binary Search Tree Iterator](https://leetcode.com/problems/binary-search-tree-iterator/description/) | Binary Tree Inorder Traversal |
| 174 | [Dungeon Game](https://leetcode.com/problems/dungeon-game/description/) | Dynamic Programming |
| 179 | [Largest Number](https://leetcode.com/problems/largest-number/description/) | Sort |
| 188 | [Best Time to Buy and Sell Stock IV](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/description/) | Dynamic Programming |
| 189 | [Rotate Array](https://leetcode.com/problems/rotate-array/description/) | Arrays |
| 190 | [Reverse Bits](https://leetcode.com/problems/reverse-bits/description/) | Bit Manipulation |
| 191 | [Number of 1 Bits](https://leetcode.com/problems/number-of-1-bits/description/) | Bit Manipulation |
| 198 | [House Robber](https://leetcode.com/problems/house-robber/description/) | Dynamic Programming |
| 200 | [Number of Islands](https://leetcode.com/problems/number-of-islands/description/) | DFS, BFS |
| 201 | [Bitwise AND of Numbers Range](https://leetcode.com/problems/bitwise-and-of-numbers-range/description/) | Bit Manipulation |
| 202 | [Happy Number](https://leetcode.com/problems/happy-number/description/) | Hash Table |
| 203 | [Remove Linked List Elements](https://leetcode.com/problems/remove-linked-list-elements/description/) | Linked List |
| 204 | [Count Primes](https://leetcode.com/problems/count-primes/description/) | Sheive Method |
| 205 | [Isomorphic Strings](https://leetcode.com/problems/isomorphic-strings/description/) | Hash Table |
| 206 | [Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/description/) | Linked List, Stack |
| 207 | [Course Schedule](https://leetcode.com/problems/course-schedule/description/) | Graph Topological Sort (DFS & BFS), Cyclic Path Detection |
| 208 | [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/description/) | Trie |
| 212 | [Word Search II](https://leetcode.com/problems/word-search-ii/description/) | Backtracking (DFS), Trie |
| 215 | [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/description/) | Heap Sort |
| 237 | [Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list/description/) | Linked List |
| 221 | [Maximal Square](https://leetcode.com/problems/maximal-square/description/) | Dynamic Programming |
| 225 | [Implement Stack using Queues](https://leetcode.com/problems/implement-stack-using-queues/description/) | Stack, Queue |
| 230 | [Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst/description/) | Binary Search Tree |
| 231 | [Power of Two](https://leetcode.com/problems/power-of-two/description/) | Bit Manipulation |
| 232 | [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/description/) | Queue, Stack |
| 233 | [Number of Digit One](https://leetcode.com/problems/number-of-digit-one/description/) | Math |
| 234 | [Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list/description/) | Linked List |
| 235 | [Lowest Common Ancestor of a Binary Search Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/) | Binary Tree |
| 236 | [Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/description/) | Binary Tree |
| 297 | [Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/description/) | BFS |
| 230 | [Kth Smallest Element in a BST](https://leetcode.com/problems/kth-smallest-element-in-a-bst/description/) | Binary Tree Traversal |
| 231 | [Power of Two](https://leetcode.com/problems/power-of-two/description/) | Bit Manipulation |
| 232 | [Implement Queue using Stacks](https://leetcode.com/problems/implement-queue-using-stacks/description/) | Stack, Queue |
| 268 | [Missing Number](https://leetcode.com/problems/missing-number/description/) | Math, Bit Manipulation |
| 287 | [Find the Duplicated Number](https://leetcode.com/problems/find-the-duplicate-number/description/) | Brutal Force, Two Pointers, Divide and Conquer |
| 292 | [Nim Game](https://leetcode.com/problems/nim-game/description/) | Math |
| 371 | [Sum of Two Integers](https://leetcode.com/problems/sum-of-two-integers/description/) | Bit Manipulation |
| 416 | [Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/description/) | Dynamic Programming |
| 437 | [Path Sum III](https://leetcode.com/problems/path-sum-iii/description/) | Backtracking (DFS) |
| 476 | [Number Complement](https://leetcode.com/problems/number-complement/description/) | Bit Manipulation |
| 507 | [Perfect Number](https://leetcode.com/problems/perfect-number/description/) | Math |
| 516 | [Longest Palindromic Subsequence](https://leetcode.com/problems/longest-palindromic-subsequence/description/) | Dynamic Programming |
| 695 | [Max Area of Island](https://leetcode.com/problems/max-area-of-island/description/) | Backtracking (DFS) |
| 725 | [Split Linked List in Parts](https://leetcode.com/problems/split-linked-list-in-parts/description/) | Linked List |