Skip to content

Talk is cheap. Show me the code.

Notifications You must be signed in to change notification settings

zhangzz2015/code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code

LeetCode Problems

# Title Solution Difficulty
1 Two Sum C++ Java easy
2 Add Two Numbers C++ Java medium
3 Longest Substring Without Repeating Characters C++ Java medium
4 Median of Two Sorted Arrays C++ Java hard
5 Longest Palindromic Substring C++ Java medium
6 ZigZag Conversion C++ Java medium
7 Reverse Integer C++ Java easy
8 String to Integer (atoi) C++ Java medium
10 Regular Expression Matching Java hard
15 3Sum C++ Java medium
16 3Sum Closest C++ Java medium
17 Letter Combinations of a Phone Number C++ Java medium
18 4Sum C++ medium
19 Remove Nth Node From End of List C++ medium
20 Valid Parentheses C++ easy
21 Merge Two Sorted Lists C++ easy
22 Generate Parentheses C++ Java medium
23 Merge k Sorted Lists C++ Java hard
24 Swap Nodes in Pairs C++ Java medium
25 Reverse Nodes in k-Group C++ Java hard
29 Divide Two Integers C++ Java medium
31 Next Permutation C++ medium
32 Longest Valid Parentheses C++ hard
33 Search in Rotated Sorted Array C++ Java medium
34 Find First and Last Position of Element in Sorted Array C++ medium
35 Search Insert Position C++ Java easy
36 Valid Sudoku C++ medium
37 Sudoku Solver Java hard
39 Combination Sum C++ Java medium
40 Combination Sum II C++ Java medium
41 First Missing Positive C++ hard
42 Trapping Rain Water C++ hard
44 Wildcard Matching C++ hard
45 Jump Game II C++ Java hard
46 Permutation C++ Java medium
47 Permutations II C++ Java medium
48 Rotate Image C++ medium
49 Group Anagrams C++ Java medium
51 N-Queens Java hard
53 Maximum Subarray C++ Java easy
54 Spiral Matrix C++ medium
55 Jump Game Java medium
56 Merge Intervals C++ medium
57 Insert Interval C++ medium
61 Rotate List C++ Java medium
62 Unique Paths C++ medium
63 Unique Paths II C++ medium
64 Minimum Path Sum C++ medium
69 Sqrt(x) Java easy
71 Simplify Path C++ medium
72 Edit Distance C++ Java hard
74 Search a 2D Matrix C++ Java medium
75 Sort Colors Java medium
76 Minimum Window Substring C++ hard
77 Combinations C++ Java medium
78 Subsets C++ Java medium
79 Word Search C++ Java medium
80 Remove Duplicates from Sorted Array II C++ medium
81 Search in Rotated Sorted Array II C++ Java medium
82 Remove Duplicates from Sorted List II C++ medium
83 Remove Duplicates from Sorted List C++ easy
84 Largest Rectangle in Histogram C++ hard
85 Maximal Rectangle C++ hard
86 Partition List C++ medium
88 Merge Sorted Array C++ easy
90 Subsets II C++ Java medium
91 Decode Ways C++ medium
92 Reverse Linked List II C++ medium
93 Restore IP Addresses C++ Java medium
95 Unique Binary Search Trees II C++ medium
96 Unique Binary Search Trees C++ medium
98 Validate Binary Search Tree C++ medium
99 Recover Binary Search Tree C++ Java hard
102 Binary Tree Level Order Traversal C++ medium
103 Binary Tree Zigzag Level Order Traversal C++ Java medium
105 Construct Binary Tree from Preorder and Inorder Traversal C++ Java medium
106 Construct Binary Tree from Inorder and Postorder Traversal C++ Java medium
108 Convert Sorted Array to Binary Search Tree C++ Java easy
109 Convert Sorted List to Binary Search Tree C++ Java medium
112 Path Sum C++ Java easy
113 Path Sum II C++ Java medium
114 Flatten Binary Tree to Linked List C++ Java medium
115 Distinct Subsequences C++ hard
116 Populating Next Right Pointers in Each Node C++ Java meduim
117 Populating Next Right Pointers in Each Node 2 C++ Java medium
120 Triangle C++ medium
121 Best Time to Buy and Sell Stock C++ easy
126 Word Ladder II Java hard
127 Word Ladder Java medium
129 Sum Root to Leaf Numbers Java medium
133 Clone Graph Java medium
139 Word Break Java medium
140 Word Break II Java hard
152 Maximum Product Subarray Java medium
153 Find Minimum in Rotated Sorted Array Java medium
154 Find Minimum in Rotated Sorted Array II Java hard
159 Longest Substring with At Most Two Distinct Characters Java medium
162 Find Peak Element Java medium
167 Two Sum II Java easy
198 House Robber Java easy
199 Binary Tree Right Side View Java medium
200 Number of Islands Java medium
207 Course Schedule Java medium
208 Implement Trie (Prefix Tree) Java medium
210 Course Schedule II Java medium
211 Design Add and Search Words Data Structure Java medium
212 Word Search II Java hard
213 House Robber II Java medium
215 Kth Largest Element in an Array Java medium
216 Combination Sum III Java medium
218 The Skyline Problem Java hard
222 Count Complete Tree Nodes Java medium
235 Lowest Common Ancestor of a Binary Search Tree Java easy
236 Lowest Common Ancestor of a Binary Tree Java medium
239 Sliding Window Maximum Java medium
240 Search a 2D Matrix II Java medium
250 Count Univalue Subtree Java medium
252 Meeting Room Java easy
253 Meeting Rooms II Java medium
255 Verify Preorder Sequence in Binary Search Tree Java medium
261 Graph Valid Tree Java medium
267 Palindrome Permutation II C++ medium
268 Missing Number Java easy
269 Alien Dictionary Java hard
270 Closest Binary Search Tree Value Java medium
271 Encode and Decode Strings Java medium
272 Closest Binary Search Tree Value II Java medium
274 H Index Java medium
275 H Index II Java medium
277 Find the Celebrity Java medium
285 Inorder Successor in BST Java medium
291 Word Pattern II Java medium
297 Serialize and Deserialize Binary Tree Java hard
300 Longest Increasing Subsequence Java medium
305 Number of Islands II Java hard
314 Binary Tree Vertical Order Traversal Java medium
315 Count of Smaller Numbers After Self Java hard
322 Coin Change Java medium
323 Number of Connected Components in an Undirected Graph Java medium
333 Largest BST Subtree Java medium
337 House Robber III Java medium
340 Longest Substring with At Most K Distinct Characters Java hard
347 Top K Frequent Elements Java medium
360 Sort Transformed Array Java medium
377 Combination Sum IV C++ Java medium
426 Convert Binary Search Tree to Sorted Doubly Linked List Java medium
428 Serialize and Deserialize N-ary Tree Java hard
437 Path Sum III Java medium
438 Find All Anagrams in a String Java medium
445 Add Two Numbers II Java medium
450 Delete Node in a BST Java medium
463 Island Perimeter Java easy
494 Target Sum C++ medium
510 Inorder Successor in BST II Java medium
518 Coin Change 2 Java medium
540 Single Element in a Sorted Array Java medium
542 01 Matrix Java medium
545 Boundary of Binary Tree Java medium
547 Friend Circles Java medium
611 Valid Triangle Number Java medium
617 Merge Two Binary Trees Java easy
632 Smallest Range Covering Elements from K Lists Java hard
640 Solve the Equation Java medium
*653 Two Sum IV - Input is a BST Java easy
658 Find K Closest Elements Java medium
668 Kth Smallest Number in Multiplication Table Java hard
695 Max Area of Island Java medium
733 Flood Fill Java easy
744 Find Smallest Letter Greater Than Target Java easy
773 Sliding Puzzle Java hard
785 Is Graph Bipartite Java medium
802 Find Eventual Safe States Java medium
865 Smallest Subtree with all the Deepest Nodes Java medium
958 Check Completeness of a Binary Tree Java medium
994 Rotting Oranges Java medium
997 Find the Town Judge Java easy
1008 Construct Binary Search Tree from Preorder Traversal Java medium
1060 Missing Element in Sorted Array Java medium
1095 Find in Mountain Array Java hard
1100 Find K-Length Substrings With No Repeated Characters Java medium
1228 Missing Number in Arithmetic Progression Java easy
1229 Meeting Scheduler Java medium
1254 Number of Closed Islands C++ medium
1306 Jump Game III Java medium
1584 Min Cost to Connect All Points Java medium
1602 Find Nearest Right Node in Binary Tree Java medium
1727 Largest Submatrix With Rearrangements C++ medium

Fun Problems

topic Title Solution
binary search Find Local Minimum Java
binary search Random Generator Java
binary search Smaller Equal in 2D Matrix Java
binary search Larger in 2D Matrix Java
sampling Reservoir Sampling Java
sampling General Reservoir Sampling Java
sampling Sampling in Binary Tree Java
sorting Selection Sort Java
sorting Bubble Sort Java
sorting Insertion Sort Java
sorting Heap Sort Java
sorting Merge Sort Java
sorting Quick Sort Java
sorting Quick Select Java
sorting Rainbow Sort with K Color Java
two pointers Number of Pairs of Two Sum Java
two pointers Two Sum from Two Arrays Java
two pointers Number of Triples Smaller than Target Java
two pointers Three Sum in BST Java
prefix sum Subarray Sum Closest to Target Java
sliding window Most Online Virtual Machines Java
sliding window Max weight Sum(follow up) Java
sliding window Product of K Sliding Window Java
sliding window Number of Pairs Smaller or Equal to Target Java
sliding window Number of Pairs Difference Smaller or Equal to Target in Two Arrays Java
sliding window Minimal Length of Subarray Sum Larger Than Target Java
sliding window Most Frequent of K Sliding Window Java
sliding window Count Time for Tasks with Cool Down without Changing Order Java
sliding window Size of Longest Subarray with Any Absolute Difference Smaller than Target Java
string Reverse Sentence in Size K Java
string Decode Parenthesis String Java
string Add String Java
string Subtract String Java
string Form Target String with Source String Java
linked list Reverse a Doubly Linked List Java
linked list Find Middle Node of Linked List Java
linked list Merged Lists C++ Java
linked list Reverse LinkedList in K Group Java
tree Inorder Traversal in Binary Tree Java
tree Preorder Traversal in Binary Tree Java
tree Postorder Traversal in Binary Tree Java
tree Kth Largest Element in BST Java
tree Binary Tree Top View or Bottom View Java
tree Populate Next Pointer Java
tree Sum of All Leaf Nodes in n-ary tree with O(1) space Java
tree Visible Nodes in Tree Java
tree Sum Leaf to Root Numbers Java
tree Equivalent Trees Java
tree Outside to Inside Java
tree Remove All Zero Subtree Java
tree Remove All Nodes with Only One Child Java
tree Or of Two Binary Trees Java
tree And Operation on Quadtree Java
tree Retain Nodes in Range for BST Java
tree Collect Leaf and Remove Java
tree Determine Perfect Tree Java
tree Check Full Tree Java
tree Lowest Common Ancestor May Not Exist Java
tree Lowest Common Ancestor With Parent Pointer Java
tree K Nodes Lowest Common Ancestor Java
tree Lowest Common Ancestor in K-nary tree Java
tree K Nodes Lowest Common Ancestor in K-nary Tree Java
tree Number of Edges Between Two Nodes Java
tree Change Value of Each Node of BST to Prefixsum Java
tree Sum of Nested Integer Weighted by Depth Java
tree K Closest to Target in BST Java
tree Find Most Frequent Element in BST Java
tree Divide BST Using Pivot Java
tree path Up Down Any to Any Largest Path Sum Java
tree path Any to Any Largest Path Sum Java
tree path Path Sum to Target Java
tree path Path Product to Target Java
tree path Longest Increasing Path Java
tree path Hours of Burn Down the Whole Tree Java
serialize tree Convert 3-ary Tree to Singly Link List Java
serialize tree Convert BST to Sorted Circular Doubly Linked List Java
serialize tree Serialize and Deserialize String Type Tree Java
construct tree Given BST Preorder Return Postorder Java
construct tree Construct Binary Tree with Levelorder and Inorder Java
construct tree Construct Binary Search Tree With Level Order Java
construct tree Construct Binary Tree with Special Signal Java
construct tree Construct N-ary Tree with Preorder and Postorder Java
construct tree Construct N-ary Tree with Parent Id Node Java
hybrid data structure Top K Frequency Problem Java
hybrid data structure K-diff Sorted Array Java
hybrid data structure Most Recent k URLs Java
backtracking All Combinations Sum to Target with Size k Java
backtracking Make Work Schedule Java
backtracking Keep Distance for Number of Element Java
backtracking Possible Score Sequence Football Game Java
graph Basic DFS Java
graph Basic BFS Java
graph Deep Copy an Undirected Graph Java
graph Determine if Graph Has Cycle Java
graph Determine if Directed Graph is Tree Java
graph All Nodes Reached in K Steps Java
graph All Nodes Reached by exactly K Steps Java
graph Top K M levels of Similar Songs Java
graph Divide People with Whom They Want to Work With Java
graph Traverse All Places with One Cycle Java
graph Bi-Directional BFS Java
topological order Topological Order Java
topological order Get All Topological Order Java
topological order Compile Source File Java
dp Return Maximum Subarray C++
dp Split Words Java
dp Largest Square Sum Java
dp Max weight Sum Java
dp Maximum Subset Sum C++
dp Cross Bridge C++
intervals Common Free Intervals for Employees Java

Data Structures

Data Structures Implementation
Queue Java
Min Heap / PriorityQueue Java
HashMap Java
Tree Inorder Iterator Java
Binary Search Tree Inorder Asc/Des Iterator Java
Tree Preorder Iterator Java
Tree Postorder Iterator Java
Union Find Java
Trie Java
Segment Tree Java

Designs

Designs Implementation
Browser History Java
Design Add Remove Find Random APIs in O(1) time Java
Auto Spell Correction Java

About

Talk is cheap. Show me the code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published