Skip to content

FriedCosey/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

5. Longest Palindromic Substring

(Reference: https://leetcode.com/problems/longest-palindromic-substring/solution/)

Solution Date
Longest Common Substring 6/24
Brute Force 6/24
Dynamic Programming 8/14
Expand Around Center 8/12

92. Reverse Linked List II

Solution Date
Head->Rev->End 7/5

46. Permutations

Solution Date
BackTracking 7/7
Dfs 7/7

47. Permutations II

Solution Date
BackTracking 7/7
Dfs

28. Implement strStr()

Solution Date
BruteForce 7/9
Kmp

39. Combination Sum

Solution Date
Dfs 7/10

16. 3Sum Closest

Solution Date
Two Pointers 7/11

48. Rotate Image

Solution Date
Sym->UpDown 7/12

17. Letter Combinations of a Phone Number

Solution Date
Dfs 7/12
Bfs

38. Count and Say

Solution Date
Brute Force 7/12

22. Generate Parentheses

Solution Date
Dfs 7/15

(Other Solutions, Reference: https://leetcode.com/problems/generate-parentheses/solution/)

Solution Date
BackTracking 7/15
Closure Number
Dynamic Programming

8. String to Integer (atoi)

Solution Date
7/18

24. Swap Nodes in Pairs

Solution Date
Iterative 7/19
Recursive 7/19

(Other Solutions, Reference: https://leetcode.com/problems/swap-nodes-in-pairs/discuss/11019/7-8-lines-C++-Python-Ruby?page=2)

Solution Date
pointer to pointer 7/19

(Other Solutions, Reference: APAS)

Solution Date
swap function (IterII) 7/19
break swap (IterIII) 7/19

29. Divide Two Integers

Solution Date
LeftShift 7/20
RightShift

(Other Solutions, Reference: https://leetcode.com/problems/divide-two-integers/discuss/13407/Detailed-Explained-8ms-C++-solution)

Solution Date
Use Remainder 7/21

33. Search in Rotated Sorted Array

Solution Date
Revise Binary Search 7/22

(Other Solutions, Reference: https://leetcode.com/problems/search-in-rotated-sorted-array/discuss/14425/Concise-O(log-N)-Binary-search-solution)

Solution Date
Find Smallest First 7/22

(Other Solutions, Reference: https://leetcode.com/problems/search-in-rotated-sorted-array/discuss/14435/Clever-idea-making-it-simple?page=2)

Solution Date
Infinity 7/24

153. Find Minimum in Rotated Sorted Array

Solution Date
MidHigh 7/24
MidLow 7/24

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

Solution Date
Expand if duplicate 7/24

(Other Solutions, Reference: https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/discuss/)

Solution Date
Divide & Conquer

(Other Solutions, Reference: https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/discuss/14699/Clean-iterative-solution-with-two-binary-searches-(with-explanation))

Solution Date
Two Binary Search

(Other Solutions, Reference: https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/solution/)

36. Valid Sudoku

Solution Date
Row Col Box 7/25

(Other Solutions, Reference: https://leetcode.com/problems/valid-sudoku/discuss/15464/My-short-solution-by-C++.-O(n2))

Solution Date
Row Col Box (One Loop)

40. Combination Sum II

Solution Date
Dfs 7/25

43. Multiply Strings

Solution Date
Multiply 7/26

(Other Solutions, Reference: https://leetcode.com/problems/multiply-strings/discuss/17646/Brief-C++-solution-using-only-strings-and-without-reversal)

Solution Date
Multiply - Preallocate 7/26

(Other Solutions, Reference: https://leetcode.com/problems/multiply-strings/discuss/17605/Easiest-JAVA-Solution-with-Graph-Explanation)

Solution Date
MultiplyByPair

50. Pow(x, n)

Solution Date
divide by 2 (Need Fix!) 7/26

(Other Solutions, Reference: https://leetcode.com/problems/powx-n/discuss/19546/Short-and-easy-to-understand-solution)

Solution Date
multiply by 2 7/26

(Other Solutions, Reference: https://leetcode.com/problems/powx-n/discuss/19544/5-different-choices-when-talk-with-interviewers)

Solution Date
Nest MyPow
Iterative
Bit Op

53. Maximum Subarray

Solution Date
Scan until less than zero 7/27

(Other Solutions, Reference: https://leetcode.com/problems/maximum-subarray/discuss/20193/DP-solution-and-some-thoughts)

Solution Date
DP 7/27

62. Unique Paths

Solution Date
Dfs (TLE) 7/27
Recursive
DP 7/27

(Other Solutions, Reference: https://leetcode.com/problems/unique-paths/discuss/22954/0ms-5-lines-DP-Solution-in-C++-with-Explanations)

Solution Date
Optimize DP (Space: O(min(m,n)) 7/27

(Other Solutions, Reference: https://leetcode.com/problems/unique-paths/discuss/22958/Math-solution-O(1)-space?page=2)

Solution Date
Combinatorial 7/27

63. Unique Paths II

Solution Date
DP 7/27

64. Minimum Path Sum

Solution Date
Dfs(TLE) 7/30
DP 7/30
DP (With One Array (#62)
DP 7/30

88. Merge Sorted Array

Solution Date
Brute Force 8/2

(Other Solutions, Reference: https://leetcode.com/problems/merge-sorted-array/discuss/29522/This-is-my-AC-code-may-help-you)

Solution Date
Check From Tail 8/2

61. Rotate List

Solution Date
Length, Fast, Slow 8/2

(Other Solutions, Reference: https://leetcode.com/problems/rotate-list/discuss/22735/My-clean-C++-code-quite-standard-(find-tail-and-reconnect-the-list))

Solution Date
Length, Tail

54. Spiral Matrix

Solution Date
Right Down Left Up Check 8/2

(Other Solutions, Reference: https://leetcode.com/problems/spiral-matrix/discuss/20599/Super-Simple-and-Easy-to-Understand-Solution)

Solution Date
Right Down Left Up

55. Jump Game

Solution Date
Update Index 8/3

(Other Solutions, Reference: https://leetcode.com/problems/jump-game/discuss/20900/Simplest-O(N)-solution-with-constant-space)

Solution Date
Backward 8/3

(Other Solutions, Reference: https://leetcode.com/problems/jump-game/solution/)

Solution Date
DP ( top-down )
DP ( bottom-up )

71. Simplify Path

Solution Date
Brute Force 8/3

(Other Solutions, Reference: https://leetcode.com/problems/simplify-path/discuss/25773/My-O(n)-AC-code-.-just-need-to-handle-two-special-cases.)

Solution Date
Brute Force (Simpilfy Special Case Comparison)

(Other Solutions, Reference: https://leetcode.com/problems/simplify-path/discuss/25680/C++-10-lines-solution)

Solution Date
GetLine

56. Merge Intervals

Solution Date
Sort -> Compare 8/3

(Other Solutions, Reference: https://leetcode.com/problems/merge-intervals/description/)

59. Spiral Matrix II

Solution Date
Right Down Left Up Check 8/3

(Other Solutions, Reference: https://leetcode.com/problems/spiral-matrix-ii/discuss/22282/4-9-lines-Python-solutions)

60. Permutation Sequence

Solution Date
NextPermutation 8/3

(Other Solutions, Reference: https://leetcode.com/problems/permutation-sequence/discuss/22507/%22Explain-like-I'm-five%22-Java-Solution-in-O(n))

Solution Date
Factorial 8/6

69. Sqrt(x)

Solution Date
Binary Search 8/6

100. Same Tree

(Reference: https://leetcode.com/problems/same-tree/discuss/32687/Five-line-Java-solution-with-recursion)

Solution Date
Inorder 8/6
Preorder
Postorder

70. Climbing Stairs

Solution Date
Combination (n = 44 Fail)

(Other Solutions, Reference: https://leetcode.com/problems/climbing-stairs/discuss/25299/Basically-it's-a-fibonacci.)

Solution Date
Fibonacci 8/8

125. Valid Palindrome

Solution Date
Head & Tail 8/14

516. Longest Palindromic Subsequence

Solution Date
Dynamic Programming 8/15

Lintcode-458.LastPositionofTarget

Solution Date
Brute Force 8/17

(Other Solutions, Reference: https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/discuss/14699/Clean-iterative-solution-with-two-binary-searches-(with-explanation)?page=4)

Solution Date
Revised Binary Search 8/17

LintCode-585. Maximum Number in Mountain Sequence

Solution Date
Revised Binary Search 8/17

658. Find K Closest Elements

Solution Date
Binary Search Condition 1 8/18
Binary Search Condition 2 8/18
Binary Search Condition 3 8/18
Binary Search Condition 4 8/18

LintCode-447. Search in a Big Sorted Array

Solution Date
Revised Binary Search 8/18

162. Find Peak Element

Solution Date
Iter1 8/18

(Other Solutions, Reference: https://leetcode.com/problems/find-peak-element/solution/)

Solution Date
Iter2
Sequential
Recursive

278. First Bad Version

Solution Date
Revised Binary Search 8/18

876. Middle of the Linked List

(Other Solutions, Reference: https://leetcode.com/problems/middle-of-the-linked-list/solution/)

Solution Date
Two Pointers 8/19

LintCode-228. Middle of Linked List

(Other Solutions, Reference: https://leetcode.com/problems/middle-of-the-linked-list/solution/)

Solution Date
Two Pointers 8/19

283. Move Zeroes

Solution Date
Swap 8/19

(Other Solutions, Reference: https://leetcode.com/problems/move-zeroes/solution/)

Solution Date
Swap Optimize 8/19
Copy 8/19

LintCode-521. Remove Duplicate Numbers in Array

Solution Date
Target and 2 pointers 8/19
Sort 8/19
Hash 8/19

75. Sort Colors

Solution Date
Counting Sort In Place 8/19
Counting Sort Out Place 8/19
Two Pointers 8/19
Two Pointers Optimize 8/20

LintCode-143. Sort Colors II

Solution Date
Count In Place 8/19
Two Pointers 8/20

LintCode-31. Partition Array

Solution Date
Two Pointers 8/20

607. Two Sum III - Data structure design

Solution Date
Hash Table 8/20

215. Kth Largest Element in an Array

Solution Date
Quick Sort Half 8/21

200. Number of Islands

Solution Date
Bfs 8/21
Bfs Optimize 8/22
Dfs
Union Find

102. Binary Tree Level Order Traversal

Solution Date
Bfs Vector 8/24
Bfs Queue 8/24
Dfs

207. Course Schedule

(Reference: https://leetcode.com/problems/course-schedule/discuss/58509/18-22-lines-C++-BFSDFS-Solutions)

Solution Date
Bfs Vector 8/24

(Other Solutions, Reference: https://leetcode.com/problems/course-schedule/discuss/58516/Easy-BFS-Topological-sort-Java)

Solution Date
Bfs Queue 8/24
Dfs

LintCode-611. Knight Shortest Path

Solution Date
Bfs Level 8/25

127. Word Ladder

(Reference: https://leetcode.com/problems/word-ladder/discuss/40707/Easy-76ms-C++-Solution-using-BFS)

Solution Date
Bfs Level 8/25

444. Sequence Reconstruction

Solution Date
Topological 8/26

297. Serialize and Deserialize Binary Tree

(Reference: https://leetcode.com/problems/serialize-and-deserialize-binary-tree/discuss/74252/Clean-C++-solution)

Solution Date
Preorder 8/26

(Other Solutions, Reference: https://leetcode.com/problems/serialize-and-deserialize-binary-tree/discuss/74264/Short-and-straight-forward-BFS-Java-code-with-a-queue)

Solution Date
Bfs

210. Course Schedule II

Solution Date
Topological Sort 8/26

LintCode-127. Topological Sorting

Solution Date
Topological Sort 8/26

133. Clone Graph

(Reference: https://leetcode.com/problems/clone-graph/discuss/42313/7-17-lines-C++-BFSDFS-Solutions)

Solution Date
Bfs 8/26
Dfs

270. Closest Binary Search Tree Value

Solution Date
Iterative 8/26
Iter Optimize 8/26
Recuresive 8/26

LintCode-596. Minimum Subtree

Solution Date
Dfs Traverse 8/28

114. Flatten Binary Tree to Linked List

(Reference: https://leetcode.com/problems/flatten-binary-tree-to-linked-list/discuss/36977/My-short-post-order-traversal-Java-solution-for-share)

Solution Date
PostOrder 8/29

110. Balanced Binary Tree

Solution Date
Traverse 9/1

104. Maximum Depth of Binary Tree

Solution Date
Bfs 9/1
Dfs 9/1

559. Maximum Depth of N-ary Tree

Solution Date
Dfs 9/1
Bfs

230. Kth Smallest Element in a BST

Solution Date
Count Left Elements 9/1

(Other Solutions, Reference: https://leetcode.com/problems/kth-smallest-element-in-a-bst/discuss/63660/3-ways-implemented-in-JAVA-(Python):-Binary-Search-in-order-iterative-and-recursive)

Solution Date
Dfs Inorder 9/1

236. Lowest Common Ancestor of a Binary Tree

Solution Date
Check Left Right 9/1

94. Binary Tree Inorder Traversal

Solution Date
Recursive 9/3

(Other Solutions, Reference: https://leetcode.com/articles/binary-tree-inorder-traversal/)

Solution Date
Iterative 9/3

599. Minimum Index Sum of Two Lists

Solution Date
Hash map 9/3

564. Find the Closest Palindrome

(Reference: https://leetcode.com/problems/find-the-closest-palindrome/discuss/102396/C++-short-solution-only-need-to-compare-5-numbers)

Solution Date
Find Candidates 9/3

(Other Solutions, Reference: https://leetcode.com/problems/find-the-closest-palindrome/solution/)

Solution Date
Using Math

98. Validate Binary Search Tree

(Reference: https://leetcode.com/problems/validate-binary-search-tree/discuss/32112/Learn-one-iterative-inorder-traversal-apply-it-to-multiple-tree-questions-(Java-Solution)?page=2)

Solution Date
Iter 9/3

272. Closest Binary Search Tree Value II

(Reference: https://leetcode.com/problems/closest-binary-search-tree-value-ii/discuss/70499/Java-5ms-iterative-following-hint-O(klogn)-time-and-space)

Solution Date
Two Stack 9/4

131. Palindrome Partitioning

Solution Date
Backtracking 9/4

77. Combinations

Solution Date
Backtracking 9/4

78. Subsets

Solution Date
Backtracking 9/4

90. Subsets II

Solution Date
Backtracking 9/4
Iterative

140. Word Break II

Solution Date
Backtracking (TLE) 9/4

443. String Compression

Solution Date
Map 9/7
Two Pointers

139. Word Break

(Todo: https://leetcode.com/problems/word-break/solution/)

140. Word Break II

(Todo: https://leetcode.com/problems/word-break-ii/solution/)

81. Search in Rotated Sorted Array II

Solution Date
Find Pivot 9/9

(Other Solutions, Reference: https://leetcode.com/problems/search-in-rotated-sorted-array-ii/discuss/28218/My-8ms-C++-solution-(o(logn)-on-average-o(n)-worst-case))

Solution Date
One loop

44. Wildcard Matching

(Todo: https://leetcode.com/problems/wildcard-matching/discuss/17810/Linear-runtime-and-constant-space-solution)

(Todo: https://leetcode.com/problems/wildcard-matching/discuss/17957/C++-DP-solution)

Solution Date
Dp

51. N-Queens

Solution Date
Dfs 9/9

(Other Solutions, Reference: https://leetcode.com/problems/n-queens/discuss/19808/Accepted-4ms-c++-solution-use-backtracking-and-bitmask-easy-understand.)

Solution Date
Bitmask

52. N-Queens II

(Other Solutions, Reference: https://leetcode.com/problems/n-queens-ii/discuss/20058/Accepted-Java-Solution?page=1)

Solution Date
No place grid

79. Word Search

Solution Date
Dfs 9/9

290. Word Pattern

Solution Date
Two Map 9/10

80. Remove Duplicates from Sorted Array II

Solution Date
Two Pointers 9/11

91. Decode Ways

Solution Date
Dp 9/11

103. Binary Tree Zigzag Level Order Traversal

Solution Date
Bfs 9/11
Recursive

150. Evaluate Reverse Polish Notation

Solution Date
Stack 9/12
Recursive

647. Palindromic Substrings

Solution Date
DP 9/13

74. Search a 2D Matrix

Solution Date
Bin search 9/16
One Sorted 9/16
Row then Col 9/16

LintCode-38. Search a 2D Matrix II

Solution Date
Row then Col 9/16

LintCode-609.TwoSum - Less than or equal to target

Solution Date
Two Pointers 9/16

LintCode-587. Two Sum - Unique pairs

Solution Date
Two Pointers 9/16

364. Nested List Weight Sum II

Solution Date
Bfs 9/21

515. Find Largest Value in Each Tree Row

Solution Date
Dfs 9/22

367. Valid Perfect Square

Solution Date
Bin search 9/23

226. Invert Binary Tree

Solution Date
Recursive 9/24
Iter

617. Merge Two Binary Trees

Solution Date
Recursive 9/24
Iter

698. Partition to K Equal Sum Subsets

Solution Date
Dfs 9/29
DP

199. Binary Tree Right Side View

Solution Date
Bfs 10/13
Dfs 10/13

929. Unique Email Addresses (Go)

Solution Date
1/9

771. Jewels and Stones (Go)

Solution Date
1/9

760. Find Anagram Mappings (Go)

Solution Date
1/9

832. Flipping an Image (Go)

Solution Date
1/9

657. Robot Return to Origin (Go)

Solution Date
1/9

463. Island Perimeter (Go)

Solution Date
DFS 1/9
Iterative 1/9

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published