Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
Accelerator
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Type
/
to search
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
BrianSong
/
LeetCode
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
master
Branches
Tags
Go to file
Code
Open more actions menu
Folders and files
Name
Name
Last commit message
Last commit date
Latest commit
History
1,606 Commits
1,606 Commits
1. Two Sum (HashTable) 20.1.28 Easy
1. Two Sum (HashTable) 20.1.28 Easy
10. Regular Expression Matching (Dynamic Programming) 20.4.19 Hard
10. Regular Expression Matching (Dynamic Programming) 20.4.19 Hard
100. Same Tree (DFS) 20.3.14 Easy
100. Same Tree (DFS) 20.3.14 Easy
1000. Minimum Cost to Merge Stones (Dynamic Programming) 19.11.27 Hard
1000. Minimum Cost to Merge Stones (Dynamic Programming) 19.11.27 Hard
1007. Minimum Domino Rotations For Equal Row 20.6.17 Medium
1007. Minimum Domino Rotations For Equal Row 20.6.17 Medium
101. Symmetric Tree (DFS + BFS) 20.3.14 Easy
101. Symmetric Tree (DFS + BFS) 20.3.14 Easy
102. Binary Tree Level Order Traversal (BFS) 20.3.15 Medium
102. Binary Tree Level Order Traversal (BFS) 20.3.15 Medium
1029. Two City Scheduling (Greedy + Sort) 20.4.19 Easy
1029. Two City Scheduling (Greedy + Sort) 20.4.19 Easy
103. Binary Tree Zigzag Level Order Traversal (Deque + BFS) 20.3.15 Medium
103. Binary Tree Zigzag Level Order Traversal (Deque + BFS) 20.3.15 Medium
1031. Maximum Sum of Two Non-Overlapping Subarrays (Subarray Sum => Prefix Sum !) 20.6.16 Medium
1031. Maximum Sum of Two Non-Overlapping Subarrays (Subarray Sum => Prefix Sum !) 20.6.16 Medium
104. Maximum Depth of Binary Tree (DFS + BFS) 20.3.16 Easy
104. Maximum Depth of Binary Tree (DFS + BFS) 20.3.16 Easy
1044. Longest Duplicate Substring
1044. Longest Duplicate Substring
1048. Longest String Chain (Dynamic Programming) 20.6.15 Medium
1048. Longest String Chain (Dynamic Programming) 20.6.15 Medium
105. Construct Binary Tree from Preorder and Inorder Traversal (DFS) 20.3.17 Medium
105. Construct Binary Tree from Preorder and Inorder Traversal (DFS) 20.3.17 Medium
106. Construct Binary Tree from Inorder and Postorder Traversal (DFS) 20.3.17 Medium
106. Construct Binary Tree from Inorder and Postorder Traversal (DFS) 20.3.17 Medium
1060. Missing Element in Sorted Array(Binary Search) 20.9.12 Medium
1060. Missing Element in Sorted Array(Binary Search) 20.9.12 Medium
107. Binary Tree Level Order Traversal II (Deque + BFS) 20.3.14 Medium
107. Binary Tree Level Order Traversal II (Deque + BFS) 20.3.14 Medium
108. Convert Sorted Array to Binary Search Tree (Divide and Conquer) 20.3.18 Easy
108. Convert Sorted Array to Binary Search Tree (Divide and Conquer) 20.3.18 Easy
1088. Confusing Number II (Backtracking) 20.6.4 Hard
1088. Confusing Number II (Backtracking) 20.6.4 Hard
109. Convert Sorted List to Binary Search Tree (Linked List + Two Pointers + DFS) 20.3.18 Medium
109. Convert Sorted List to Binary Search Tree (Linked List + Two Pointers + DFS) 20.3.18 Medium
1099. Two Sum Less Than K (Two Pointers) 20.5.21 Easy
1099. Two Sum Less Than K (Two Pointers) 20.5.21 Easy
11. Container With Most Water (Two Pointers) 20.2.3 Medium
11. Container With Most Water (Two Pointers) 20.2.3 Medium
110. Balanced Binary Tree (DFS) 20.3.16 Easy
110. Balanced Binary Tree (DFS) 20.3.16 Easy
1102. Path With Maximum Minimum Value (Heap + Greedy) 20.5.22 Medium
1102. Path With Maximum Minimum Value (Heap + Greedy) 20.5.22 Medium
111. Minimum Depth of Binary Tree (BFS + DFS) 20.3.16 Easy
111. Minimum Depth of Binary Tree (BFS + DFS) 20.3.16 Easy
1110. Delete Nodes And Return Forest (DFS) 20.6.3 Medium
1110. Delete Nodes And Return Forest (DFS) 20.6.3 Medium
112. Path Sum (DFS) 20.3.18 Easy
112. Path Sum (DFS) 20.3.18 Easy
1123. Lowest Common Ancestor of Deepest Leaves(Divide and Conquer) 20.9.21 Medium
1123. Lowest Common Ancestor of Deepest Leaves(Divide and Conquer) 20.9.21 Medium
113. Path Sum II (DFS) 20.3.18 Medium
113. Path Sum II (DFS) 20.3.18 Medium
114. Flatten Binary Tree to Linked List (DFS: reversed pre-order traversal) 20.3.19 Medium
114. Flatten Binary Tree to Linked List (DFS: reversed pre-order traversal) 20.3.19 Medium
1146. Snapshot Array (Array + Binary Search) 20.9.13 Medium
1146. Snapshot Array (Array + Binary Search) 20.9.13 Medium
1153. String Transforms Into Another String (String) 20.6.4 Hard
1153. String Transforms Into Another String (String) 20.6.4 Hard
116. Populating Next Right Pointers in Each Node (BFS + Iteriative) 20.3.20 Medium
116. Populating Next Right Pointers in Each Node (BFS + Iteriative) 20.3.20 Medium
1167. Minimum Cost to Connect Sticks (Greedy with Heap) 20.5.22 Medium
1167. Minimum Cost to Connect Sticks (Greedy with Heap) 20.5.22 Medium
1169. Invalid Transactions (Sort by lambda + HashTable) 20.4.20 Medium
1169. Invalid Transactions (Sort by lambda + HashTable) 20.4.20 Medium
117. Populating Next Right Pointers in Each Node II (Iterative) 20.3.20 Medium
117. Populating Next Right Pointers in Each Node II (Iterative) 20.3.20 Medium
118. Pascal's Triangle (Dynamic Programming) 20.3.20 Easy
118. Pascal's Triangle (Dynamic Programming) 20.3.20 Easy
1188. Design Bounded Blocking Queue(Thread) 20.9.22 Medium
1188. Design Bounded Blocking Queue(Thread) 20.9.22 Medium
119. Pascal's Triangle II (Dynamic Programming) 20.3.20 Easy
119. Pascal's Triangle II (Dynamic Programming) 20.3.20 Easy
1192. Critical Connections in a Network (DFS) 19.11.23 Hard
1192. Critical Connections in a Network (DFS) 19.11.23 Hard
12. Integer to Roman (Math) 20.2.3 Easy
12. Integer to Roman (Math) 20.2.3 Easy
120. Triangle (Dynamic Programming) 20.3.21 Medium
120. Triangle (Dynamic Programming) 20.3.21 Medium
1209. Remove All Adjacent Duplicates in String II (Stack) 19.12.8 Medium
1209. Remove All Adjacent Duplicates in String II (Stack) 19.12.8 Medium
121. Best Time to Buy and Sell Stock (Greedy - One pass) 20.2.19 Easy
121. Best Time to Buy and Sell Stock (Greedy - One pass) 20.2.19 Easy
122. Best Time to Buy and Sell Stock II (Greedy - Peak Valley Approach) 20.2.20 Easy
122. Best Time to Buy and Sell Stock II (Greedy - Peak Valley Approach) 20.2.20 Easy
123. Best Time to Buy and Sell Stock III(Bidirectional Dynamic Programming) 20.10.5 Hard
123. Best Time to Buy and Sell Stock III(Bidirectional Dynamic Programming) 20.10.5 Hard
1231. Divide Chocolate (Binary Search Template) 20.6.25 Hard
1231. Divide Chocolate (Binary Search Template) 20.6.25 Hard
124. Binary Tree Maximum Path Sum (DFS) 20.4.20 Hard
124. Binary Tree Maximum Path Sum (DFS) 20.4.20 Hard
1240. Tiling a Rectangle with the Fewest Squares(Backtracking) 20.9.12 Hard
1240. Tiling a Rectangle with the Fewest Squares(Backtracking) 20.9.12 Hard
1244. Design A Leaderboard(Heapq) 20.9.22 Medium
1244. Design A Leaderboard(Heapq) 20.9.22 Medium
1249. Minimum Remove to Make Valid Parentheses (Stack) 20.5.28 Medium
1249. Minimum Remove to Make Valid Parentheses (Stack) 20.5.28 Medium
125. Valid Palindrome (Two Pointers) 20.2.2 Easy
125. Valid Palindrome (Two Pointers) 20.2.2 Easy
126. Word Ladder II (BFS) 20.4.30 Hard
126. Word Ladder II (BFS) 20.4.30 Hard
127. Word Ladder (HashTable + BFS) 20.3.22 Medium
127. Word Ladder (HashTable + BFS) 20.3.22 Medium
1274. Number of Ships in a Rectangle(Divide and Conquer) 20.9.21 Hard
1274. Number of Ships in a Rectangle(Divide and Conquer) 20.9.21 Hard
1277. Count Square Submatrices with All One (Dynamic Programming) 20.6.29 Medium
1277. Count Square Submatrices with All One (Dynamic Programming) 20.6.29 Medium
128. Longest Consecutive Sequence (Sort + HashSet) 20.4.22 Hard
128. Longest Consecutive Sequence (Sort + HashSet) 20.4.22 Hard
129. Sum Root to Leaf Numbers (DFS) 20.3.19 Medium
129. Sum Root to Leaf Numbers (DFS) 20.3.19 Medium
1293. Shortest Path in a Grid with Obstacles Elimination(BFS) 20.9.13 Hard
1293. Shortest Path in a Grid with Obstacles Elimination(BFS) 20.9.13 Hard
1296. Divide Array in Sets of K Consecutive Numbers (Counter) 20.6.21 Medium
1296. Divide Array in Sets of K Consecutive Numbers (Counter) 20.6.21 Medium
13. Roman to Integer (Hashtable + Math) 20.2.3 Easy
13. Roman to Integer (Hashtable + Math) 20.2.3 Easy
130. Surrounded Regions (BFS + Queue) 20.3.24 Medium
130. Surrounded Regions (BFS + Queue) 20.3.24 Medium
131. Palindrome Partitioning (Backtracking) 20.3.25 Medium
131. Palindrome Partitioning (Backtracking) 20.3.25 Medium
1320. Minimum Distance to Type a Word Using Two Fingers (Dynamic Programming) 20.6.23 Hard
1320. Minimum Distance to Type a Word Using Two Fingers (Dynamic Programming) 20.6.23 Hard
133. Clone Graph (Deep Copy + HashTable + DFS) 20.3.26 Medium
133. Clone Graph (Deep Copy + HashTable + DFS) 20.3.26 Medium
134. Gas Station (Greedy) 20.4.22 Medium
134. Gas Station (Greedy) 20.4.22 Medium
1345. Jump Game IV(BFS) 20.7.8 Hard
1345. Jump Game IV(BFS) 20.7.8 Hard
136. Single Number (Bit Manipulation)
136. Single Number (Bit Manipulation)
137. Single Number II (Bit Manipulation)
137. Single Number II (Bit Manipulation)
1376. Time Needed to Inform All Employees (Heap + BFS) 20.9.11 Medium
1376. Time Needed to Inform All Employees (Heap + BFS) 20.9.11 Medium
138. Copy List with Random Pointer (Deep Copy + HashTable + DFS + Interleaving: O(1) S)) 20.3.26 Medium
138. Copy List with Random Pointer (Deep Copy + HashTable + DFS + Interleaving: O(1) S)) 20.3.26 Medium
139. Word Break (Dynamic Programming) 20.3.27 Medium
139. Word Break (Dynamic Programming) 20.3.27 Medium
14. Longest Common Prefix (String - Horizontal Scanning) 20.2.4 Easy
14. Longest Common Prefix (String - Horizontal Scanning) 20.2.4 Easy
140. Word Break II (DFS + DP + Memo) 20.9.20 Hard
140. Word Break II (DFS + DP + Memo) 20.9.20 Hard
141. Linked List Cycle (HashTable+ Two Pointers) 20.3.27 Easy
141. Linked List Cycle (HashTable+ Two Pointers) 20.3.27 Easy
142. Linked List Cycle II (HashTable + Two Pointers) 20.3.27 Medium
142. Linked List Cycle II (HashTable + Two Pointers) 20.3.27 Medium
1423. Maximum Points You Can Obtain from Cards(Sliding Window) 20.7.6 Medium
1423. Maximum Points You Can Obtain from Cards(Sliding Window) 20.7.6 Medium
143. Reorder List (Linked List) 20.3.29 Medium
143. Reorder List (Linked List) 20.3.29 Medium
1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit (Sliding Window + Deque) 20.6.29 Medium
1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit (Sliding Window + Deque) 20.6.29 Medium
144. Binary Tree Preorder Traversal (DFS +Stack) 20.3.7 Medium
144. Binary Tree Preorder Traversal (DFS +Stack) 20.3.7 Medium
145. Binary Tree Postorder Traversal (DFS + Stack in modified pre-order) 20.3.7 Hard
145. Binary Tree Postorder Traversal (DFS + Stack in modified pre-order) 20.3.7 Hard
1458. Max Dot Product of Two Subsequences (Dynamic Programming) 20.6.10 Hard
1458. Max Dot Product of Two Subsequences (Dynamic Programming) 20.6.10 Hard
146. LRU Cache (Design: Deque + HashTable + Double Linked List) 20.4.23 Medium
146. LRU Cache (Design: Deque + HashTable + Double Linked List) 20.4.23 Medium
1463. Cherry Pickup II(DFS + memo) 20.9.13 Hard
1463. Cherry Pickup II(DFS + memo) 20.9.13 Hard
147. Insertion Sort List (Three Pointers: dummy, curr, p - Insertion Sort)
147. Insertion Sort List (Three Pointers: dummy, curr, p - Insertion Sort)
1473. Paint House III (Dynamic Programming) 20.6.7 Hard
1473. Paint House III (Dynamic Programming) 20.6.7 Hard
148. Sort List (Linked List + Divide and Conquer + Merge Sort) 20.2.8 Medium
148. Sort List (Linked List + Divide and Conquer + Merge Sort) 20.2.8 Medium
1487. Making File Names Unique (HashMap + Path Compression) 20.6.21 Medium
1487. Making File Names Unique (HashMap + Path Compression) 20.6.21 Medium
149. Max Points on a Line (HashTable)
149. Max Points on a Line (HashTable)
1498. Number of Subsequences That Satisfy the Given Sum Condition (Two Pointers) 20.6.28 Medium
1498. Number of Subsequences That Satisfy the Given Sum Condition (Two Pointers) 20.6.28 Medium
15. 3Sum (Two Pointers) 20.1.28 Medium
15. 3Sum (Two Pointers) 20.1.28 Medium
150. Evaluate Reverse Polish Notation (Stack + isdigit() + lstrip("-"))
150. Evaluate Reverse Polish Notation (Stack + isdigit() + lstrip("-"))
1504. Count Submatrices With All Ones(Dynamic Programming) 20.7.6 Medium
1504. Count Submatrices With All Ones(Dynamic Programming) 20.7.6 Medium
1509. Minimum Difference Between Largest and Smallest Value in Three Moves(Array) 20.7.11 Medium
1509. Minimum Difference Between Largest and Smallest Value in Three Moves(Array) 20.7.11 Medium
151. Reverse Words in a String(split() + join() + strip())
151. Reverse Words in a String(split() + join() + strip())
152. Maximum Product Subarray (Dynamic Programming) 20.2.19 Medium
152. Maximum Product Subarray (Dynamic Programming) 20.2.19 Medium
153. Find Minimum in Rotated Sorted Array (Binary Search) 20.2.11 Medium
153. Find Minimum in Rotated Sorted Array (Binary Search) 20.2.11 Medium
1548. The Most Similar Path in a Graph(Dynamic Programming) 20.9.13 Hard
1548. The Most Similar Path in a Graph(Dynamic Programming) 20.9.13 Hard
155. Min Stack (Design + Stack) 20.3.30 Easy
155. Min Stack (Design + Stack) 20.3.30 Easy
159. Longest Substring with At Most Two Distinct Characters (Sliding Window + Counter) 20.5.23 Medium
159. Longest Substring with At Most Two Distinct Characters (Sliding Window + Counter) 20.5.23 Medium
View all files
Repository files navigation
README
More
items
LeetCode
It's time to crack the LeetCode! One step after another!
About
It's time to crack the LeetCode!
Topics
leetcode-solutions
python
Resources
Readme
Activity
Stars
1
star
Watchers
0
watching
Forks
0
forks
Report repository
Releases
Packages
Used by
Contributors
Languages
You can’t perform that action at this time.