Giter VIP home page Giter VIP logo

leetcode's Introduction

Leetcode solutions for ๐Ÿš€ NeetCode.io

This repo hosts the solutions found on NeetCode.io including the solutions shown on the NeetCode YouTube channel. The site will periodically be updated with new solutions from this repo!


Solutions from these languages will be linked from NeetCode.io:

Python, Java, JavaScript, C++, Go, Swift, C#, TypeScript, Rust, Kotlin, Ruby, C, Scala and Dart

Solutions are also welcome for any other supported language on leetcode.com!

Contributing

Please read the contributing guidlines before opening a PR

To contribute, please fork this repo and open a PR adding a missing solution from the supported languages.

If you would like to have collaborator permissions on the repo to merge your own PRs or review others' PRs please let me know.

Credits

Missing Solutions

Arrays & Hashing

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0217 - Contains Duplicate
0242 - Valid Anagram
1929 - Concatenation of Array
โŒ
1299 - Replace Elements With Greatest Element On Right Side
โŒ
โŒ
0392 - Is Subsequence
โŒ
โŒ
0058 - Length of Last Word
โŒ
0001 - Two Sum
0014 - Longest Common Prefix
โŒ
โŒ
โŒ
0049 - Group Anagrams
0118 - Pascals Triangle
โŒ
โŒ
โŒ
0027 - Remove Element
โŒ
โŒ
0929 - Unique Email Addresses
โŒ
โŒ
โŒ
0205 - Isomorphic Strings
โŒ
โŒ
โŒ
0605 - Can Place Flowers
โŒ
โŒ
โŒ
0169 - Majority Element
โŒ
โŒ
โŒ
0496 - Next Greater Element I
โŒ
โŒ
โŒ
โŒ
0724 - Find Pivot Index
โŒ
โŒ
โŒ
0303 - Range Sum Query - Immutable
โŒ
โŒ
โŒ
โŒ
โŒ
0448 - Find All Numbers Disappeared in An Array
โŒ
โŒ
โŒ
โŒ
1189 - Maximum Number of Balloons
โŒ
โŒ
โŒ
โŒ
0290 - Word Pattern
โŒ
โŒ
โŒ
โŒ
0705 - Design HashSet
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0706 - Design HashMap
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0912 - Sort an Array
โŒ
โŒ
โŒ
โŒ
โŒ
0347 - Top K Frequent Elements
โŒ
0238 - Product of Array Except Self
โŒ
โŒ
0036 - Valid Sudoku
โŒ
0271 - Encode and Decode Strings
โŒ
โŒ
โŒ
0128 - Longest Consecutive Sequence
โŒ
โŒ
0075 - Sort Colors
โŒ
โŒ
โŒ
0535 - Encode and Decode TinyURL
โŒ
โŒ
โŒ
โŒ
0554 - Brick Wall
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0122 - Best Time to Buy And Sell Stock II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0560 - Subarray Sum Equals K
โŒ
โŒ
โŒ
โŒ
1930 - Unique Length 3 Palindromic Subsequences
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1963 - Minimum Number of Swaps to Make The String Balanced
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2001 - Number of Pairs of Interchangeable Rectangles
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2002 - Maximum Product of The Length of Two Palindromic Subsequences
โŒ
โŒ
โŒ
โŒ
2017 - Grid Game
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0438 - Find All Anagrams in a String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0028 - Find The Index of The First Occurrence in a String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0280 - Wiggle Sort
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0179 - Largest Number
โŒ
0523 - Continuous Subarray Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0838 - Push Dominoes
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0187 - Repeated DNA Sequences
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0380 - Insert Delete Get Random O(1)
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1461 - Check if a String Contains all Binary Codes of Size K
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0304 - Range Sum Query 2D Immutable
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0665 - Non Decreasing Array
โŒ
โŒ
โŒ
โŒ
โŒ
0041 - First Missing Positive
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1822 - Sign of An Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2215 - Find the Difference of Two Arrays
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1603 - Design Parking System
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2348 - Number of Zero-Filled Subarrays
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2405 - Optimal Partition of String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1396 - Design Underground System
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2483 - Minimum Penalty for a Shop
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0068 - Text Justification
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2306 - Naming a Company
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

Two Pointers

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0125 - Valid Palindrome
0680 - Valid Palindrome II
โŒ
โŒ
โŒ
โŒ
1984 - Minimum Difference Between Highest And Lowest of K Scores
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1768 - Merge Strings Alternately
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0344 - Reverse String
โŒ
โŒ
0088 - Merge Sorted Array
โŒ
โŒ
โŒ
โŒ
0283 - Move Zeroes
โŒ
โŒ
โŒ
0026 - Remove Duplicates From Sorted Array
โŒ
โŒ
โŒ
โŒ
0080 - Remove Duplicates From Sorted Array II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0167 - Two Sum II Input Array Is Sorted
โŒ
0015 - 3Sum
โŒ
0018 - 4Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0011 - Container With Most Water
1498 - Number of Subsequences That Satisfy The Given Sum Condition
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0189 - Rotate Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1968 - Array With Elements Not Equal to Average of Neighbors
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0881 - Boats to Save People
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0042 - Trapping Rain Water
โŒ
โŒ

Sliding Window

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0121 - Best Time to Buy And Sell Stock
โŒ
0219 - Contains Duplicate II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1343 - Number of Sub Arrays of Size K and Avg Greater than or Equal to Threshold
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0003 - Longest Substring Without Repeating Characters
โŒ
0424 - Longest Repeating Character Replacement
โŒ
โŒ
0567 - Permutation In String
โŒ
โŒ
โŒ
โŒ
1838 - Frequency of The Most Frequent Element
โŒ
โŒ
โŒ
โŒ
0904 - Fruits into Basket
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1456 - Maximum Number of Vowels in a Substring of Given Length
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1888 - Minimum Number of Flips to Make The Binary String Alternating
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0209 - Minimum Size Subarray Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0658 - Find K Closest Elements
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1658 - Minimum Operations to Reduce X to Zero
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0076 - Minimum Window Substring
โŒ
โŒ
0239 - Sliding Window Maximum
โŒ
โŒ
โŒ

Stack

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0020 - Valid Parentheses
โŒ
0682 - Baseball Game
โŒ
โŒ
โŒ
0225 - Implement Stack Using Queues
โŒ
โŒ
โŒ
โŒ
โŒ
0155 - Min Stack
โŒ
โŒ
0150 - Evaluate Reverse Polish Notation
โŒ
โŒ
2390 - Removing Stars From a String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0946 - Validate Stack Sequences
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0022 - Generate Parentheses
โŒ
โŒ
0735 - Asteroid Collision
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0739 - Daily Temperatures
โŒ
โŒ
0901 - Online Stock Span
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0853 - Car Fleet
โŒ
โŒ
โŒ
0071 - Simplify Path
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0394 - Decode String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0402 - Remove K Digits
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1209 - Remove All Adjacent Duplicates In String II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0456 - 132 Pattern
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0895 - Maximum Frequency Stack
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0084 - Largest Rectangle In Histogram
โŒ
โŒ
โŒ
โŒ

Binary Search

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0704 - Binary Search
โŒ
0035 - Search Insert Position
โŒ
โŒ
โŒ
0374 - Guess Number Higher Or Lower
โŒ
โŒ
โŒ
โŒ
โŒ
0441 - Arranging Coins
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0977 - Squares of a Sorted Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0367 - Valid Perfect Square
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0069 - Sqrt(x)
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0540 - Single Element in a Sorted Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1011 - Capacity to Ship Packages
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0162 - Find Peak Element
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2300 - Successful Pairs of Spells and Potions
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0074 - Search a 2D Matrix
โŒ
โŒ
0875 - Koko Eating Bananas
โŒ
โŒ
2616 - Minimize the Maximum Difference of Pairs
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0153 - Find Minimum In Rotated Sorted Array
โŒ
0033 - Search In Rotated Sorted Array
โŒ
โŒ
0081 - Search In Rotated Sorted Array II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0981 - Time Based Key Value Store
โŒ
โŒ
โŒ
0034 - Find First And Last Position of Element In Sorted Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1898 - Maximum Number of Removable Characters
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0116 - Populating Next Right Pointers In Each Node
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1268 - Search Suggestions System
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0410 - Split Array Largest Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0004 - Median of Two Sorted Arrays
โŒ
โŒ
โŒ
โŒ

Linked List

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0206 - Reverse Linked List
0021 - Merge Two Sorted Lists
0234 - Palindrome Linked List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0203 - Remove Linked List Elements
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0083 - Remove Duplicates From Sorted List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0876 - Middle of the Linked List
โŒ
โŒ
โŒ
0160 - Intersection of Two Linked Lists
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0143 - Reorder List
โŒ
โŒ
โŒ
โŒ
โŒ
2130 - Maximum Twin Sum Of A Linked List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0019 - Remove Nth Node From End of List
โŒ
โŒ
โŒ
1721 - Swapping Nodes in a Linked List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0460 - LFU Cache
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0138 - Copy List With Random Pointer
โŒ
โŒ
โŒ
0707 - Design Linked List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1472 - Design Browser History
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0002 - Add Two Numbers
โŒ
0141 - Linked List Cycle
โŒ
โŒ
0287 - Find The Duplicate Number
โŒ
โŒ
0024 - Swap Nodes In Pairs
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0148 - Sort List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0086 - Partition List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0061 - Rotate List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0092 - Reverse Linked List II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0622 - Design Circular Queue
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0147 - Insertion Sort List
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0725 - Split Linked List in Parts
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0146 - LRU Cache
โŒ
โŒ
โŒ
0023 - Merge K Sorted Lists
โŒ
โŒ
โŒ
0025 - Reverse Nodes In K Group
โŒ
โŒ
โŒ

Trees

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0094 - Binary Tree Inorder Traversal
โŒ
โŒ
0144 - Binary Tree Preorder Traversal
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0145 - Binary Tree Postorder Traversal
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0226 - Invert Binary Tree
โŒ
โŒ
0104 - Maximum Depth of Binary Tree
โŒ
โŒ
0543 - Diameter of Binary Tree
โŒ
โŒ
0110 - Balanced Binary Tree
โŒ
โŒ
0100 - Same Tree
โŒ
โŒ
0572 - Subtree of Another Tree
โŒ
0108 - Convert Sorted Array to Binary Search Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0617 - Merge Two Binary Trees
โŒ
โŒ
โŒ
โŒ
โŒ
0112 - Path Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0606 - Construct String From Binary Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0235 - Lowest Common Ancestor of a Binary Search Tree
โŒ
0701 - Insert into a Binary Search Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0450 - Delete Node in a BST
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0102 - Binary Tree Level Order Traversal
โŒ
โŒ
0199 - Binary Tree Right Side View
โŒ
โŒ
โŒ
0783 - Minimum Distance between BST Nodes
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0101 - Symmetric Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1443 - Minimum Time to Collect All Apples in a Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0103 - Binary Tree Zigzag Level Order Traversal
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0427 - Construct Quad Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0652 - Find Duplicate Subtrees
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0958 - Check Completeness of a Binary Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0106 - Construct Binary Tree from Inorder and Postorder Traversal
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0662 - Maximum Width of Binary Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1376 - Time Needed to Inform All Employees
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1448 - Count Good Nodes In Binary Tree
โŒ
โŒ
โŒ
0098 - Validate Binary Search Tree
โŒ
โŒ
โŒ
0230 - Kth Smallest Element In a Bst
โŒ
โŒ
0105 - Construct Binary Tree From Preorder And Inorder Traversal
โŒ
โŒ
โŒ
โŒ
โŒ
0096 - Unique Binary Search Trees
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0095 - Unique Binary Search Trees II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0129 - Sum Root to Leaf Numbers
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0337 - House Robber III
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0951 - Flip Equivalent Binary Trees
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1993 - Operations On Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0894 - All Possible Full Binary Trees
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0513 - Find Bottom Left Tree Value
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0669 - Trim a Binary Search Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0173 - Binary Search Tree Iterator
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0538 - Convert Bst to Greater Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0124 - Binary Tree Maximum Path Sum
โŒ
โŒ
โŒ
0297 - Serialize And Deserialize Binary Tree
โŒ
โŒ
โŒ
โŒ

Tries

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0208 - Implement Trie Prefix Tree
โŒ
0211 - Design Add And Search Words Data Structure
โŒ
โŒ
2707 - Extra Characters in a String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0212 - Word Search II
โŒ
โŒ
โŒ
โŒ

Heap / Priority Queue

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0703 - Kth Largest Element In a Stream
โŒ
โŒ
โŒ
1046 - Last Stone Weight
โŒ
โŒ
โŒ
0973 - K Closest Points to Origin
โŒ
โŒ
โŒ
โŒ
โŒ
0215 - Kth Largest Element In An Array
โŒ
โŒ
โŒ
0621 - Task Scheduler
โŒ
โŒ
โŒ
โŒ
โŒ
0355 - Design Twitter
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1675 - Minimize Deviation in Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2542 - Maximum Subsequence Score
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1834 - Single Threaded Cpu
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1845 - Seat Reservation Manager
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1882 - Process Tasks Using Servers
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1985 - Find The Kth Largest Integer In The Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0767 - Reorganize String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1405 - Longest Happy String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1094 - Car Pooling
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0295 - Find Median From Data Stream
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1383 - Maximum Performance of a Team
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0502 - IPO
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

Backtracking

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0078 - Subsets
โŒ
โŒ
0039 - Combination Sum
โŒ
โŒ
0077 - Combinations
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0046 - Permutations
โŒ
โŒ
0090 - Subsets II
โŒ
โŒ
โŒ
0040 - Combination Sum II
โŒ
โŒ
โŒ
โŒ
0047 - Permutations II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0079 - Word Search
โŒ
โŒ
โŒ
0131 - Palindrome Partitioning
โŒ
โŒ
โŒ
0093 - Restore IP Addresses
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0017 - Letter Combinations of a Phone Number
โŒ
โŒ
โŒ
0473 - Matchsticks to Square
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1849 - Splitting a String Into Descending Consecutive Values
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1980 - Find Unique Binary String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1239 - Maximum Length of a Concatenated String With Unique Characters
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0698 - Partition to K Equal Sum Subsets
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0051 - N Queens
โŒ
โŒ
โŒ
โŒ
0052 - N Queens II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

Graphs

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0463 - Island Perimeter
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0953 - Verifying An Alien Dictionary
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0200 - Number of Islands
โŒ
โŒ
0133 - Clone Graph
โŒ
โŒ
โŒ
0695 - Max Area of Island
โŒ
โŒ
โŒ
1905 - Count Sub Islands
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0417 - Pacific Atlantic Water Flow
โŒ
โŒ
โŒ
โŒ
0130 - Surrounded Regions
โŒ
โŒ
โŒ
โŒ
1466 - Reorder Routes to Make All Paths Lead to The City Zero
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0994 - Rotting Oranges
โŒ
โŒ
โŒ
โŒ
โŒ
0286 - Walls And Gates
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0909 - Snakes And Ladders
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0752 - Open The Lock
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0802 - Find Eventual Safe States
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0207 - Course Schedule
โŒ
โŒ
โŒ
0210 - Course Schedule II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1462 - Course Schedule IV
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1958 - Check if Move Is Legal
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0934 - Shortest Bridge
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1091 - Shortest Path in Binary Matrix
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0684 - Redundant Connection
โŒ
โŒ
โŒ
โŒ
0323 - Number of Connected Components In An Undirected Graph
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0261 - Graph Valid Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0721 - Accounts Merge
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2359 - Find Closest Node to Given Two Nodes
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1162 - As Far from Land as Possible
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1129 - Shortest Path with Alternating Colors
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2477 - Minimum Fuel Cost to Report to the Capital
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2492 - Minimum Score of a Path Between Two Cities
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1254 - Number of Closed Islands
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1020 - Number of Enclaves
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1557 - Minimum Number of Vertices to Reach all Nodes
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0785 - Is Graph Bipartite?
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0399 - Evaluate Division
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2101 - Detonate the Maximum Bombs
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1857 - Largest Color Value in a Directed Graph
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1553 - Minimum Number of Days to Eat N Oranges
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0127 - Word Ladder
โŒ
โŒ
โŒ
โŒ
โŒ

Advanced Graphs

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
1631 - Path with Minimum Effort
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0332 - Reconstruct Itinerary
โŒ
โŒ
โŒ
โŒ
โŒ
1584 - Min Cost to Connect All Points
โŒ
โŒ
โŒ
โŒ
โŒ
0743 - Network Delay Time
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1514 - Path with Maximum Probability
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0778 - Swim In Rising Water
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0269 - Alien Dictionary
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0787 - Cheapest Flights Within K Stops
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2421 - Number of Good Paths
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1579 - Remove Max Number of Edges to Keep Graph Fully Traversable
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1489 - Find Critical and Pseudo Critical Edges in Minimum Spanning Tree
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

1-D Dynamic Programming

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0070 - Climbing Stairs
โŒ
0746 - Min Cost Climbing Stairs
0198 - House Robber
โŒ
0213 - House Robber II
โŒ
0005 - Longest Palindromic Substring
โŒ
โŒ
โŒ
โŒ
0647 - Palindromic Substrings
โŒ
โŒ
โŒ
โŒ
0091 - Decode Ways
โŒ
โŒ
โŒ
โŒ
0322 - Coin Change
โŒ
โŒ
โŒ
0152 - Maximum Product Subarray
โŒ
โŒ
0139 - Word Break
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0300 - Longest Increasing Subsequence
โŒ
โŒ
โŒ
โŒ
0416 - Partition Equal Subset Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0120 - Triangle
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0740 - Delete And Earn
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0256 - Paint House
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0377 - Combination Sum IV
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0279 - Perfect Squares
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2369 - Check if There is a Valid Partition For The Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1856 - Maximum Subarray Min Product
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0983 - Minimum Cost For Tickets
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0343 - Integer Break
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0673 - Number of Longest Increasing Subsequence
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0691 - Stickers to Spell Word
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1137 - N-th Tribonacci Number
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1035 - Uncrossed Lines
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2140 - Solving Questions With Brainpower
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2466 - Count Ways to Build Good Strings
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0837 - New 21 Game
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1626 - Best Team with no Conflicts
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1406 - Stone Game III
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0472 - Concatenated Words
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1799 - Maximize Score after N Operations
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1964 - Find the Longest Valid Obstacle Course at Each Position
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1359 - Count all Valid Pickup and Delivery Options
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

2-D Dynamic Programming

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0062 - Unique Paths
โŒ
โŒ
โŒ
โŒ
0063 - Unique Paths II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1143 - Longest Common Subsequence
โŒ
โŒ
โŒ
0516 - Longest Palindromic Subsequence
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1049 - Last Stone Weight II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0309 - Best Time to Buy And Sell Stock With Cooldown
โŒ
โŒ
โŒ
0518 - Coin Change II
โŒ
โŒ
โŒ
โŒ
0494 - Target Sum
โŒ
โŒ
โŒ
โŒ
โŒ
0097 - Interleaving String
โŒ
โŒ
โŒ
โŒ
0877 - Stone Game
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0064 - Minimum Path Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0329 - Longest Increasing Path In a Matrix
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0221 - Maximal Square
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0474 - Ones and Zeroes
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
5782 - Maximum Alternating Subsequence Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0115 - Distinct Subsequences
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0072 - Edit Distance
โŒ
โŒ
โŒ
โŒ
โŒ
1220 - Count Vowels Permutation
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0312 - Burst Balloons
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1866 - Number of Ways to Rearrange Sticks With K Sticks Visible
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0010 - Regular Expression Matching
โŒ
โŒ
โŒ
โŒ
โŒ
1140 - Stone Game II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0926 - Flip String to Monotone Increasing
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2218 - Maximum Value of K Coins from Piles
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0920 - Number of Music Playlists
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1639 - Number of Ways to Form a Target String Given a Dictionary
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0879 - Profitable Schemes
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1547 - Minimum Cost to Cut a Stick
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

Greedy

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0053 - Maximum Subarray
โŒ
โŒ
0918 - Maximum Sum Circular Subarray
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0978 - Longest Turbulent Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0055 - Jump Game
โŒ
โŒ
โŒ
0045 - Jump Game II
โŒ
โŒ
โŒ
1871 - Jump Game VII
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0134 - Gas Station
โŒ
โŒ
โŒ
0846 - Hand of Straights
โŒ
โŒ
โŒ
โŒ
2439 - Minimize Maximum of Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0649 - Dota2 Senate
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1423 - Maximum Points You Can Obtain From Cards
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1899 - Merge Triplets to Form Target Triplet
โŒ
โŒ
โŒ
โŒ
0763 - Partition Labels
โŒ
โŒ
โŒ
โŒ
โŒ
0678 - Valid Parenthesis String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1921 - Eliminate Maximum Number of Monsters
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1029 - Two City Scheduling
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0646 - Maximum Length of Pair Chain
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1647 - Minimum Deletions to Make Character Frequencies Unique
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
135- - Candy
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

Intervals

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0057 - Insert Interval
โŒ
โŒ
โŒ
0056 - Merge Intervals
โŒ
โŒ
โŒ
0435 - Non Overlapping Intervals
โŒ
โŒ
โŒ
โŒ
0252 - Meeting Rooms
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0253 - Meeting Rooms II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1288 - Remove Covered Intervals
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1851 - Minimum Interval to Include Each Query
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0352 - Data Stream as Disjoint Intervals
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

Math & Geometry

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0168 - Excel Sheet Column Title
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1071 - Greatest Common Divisor of Strings
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1523 - Count Odd Numbers in an Interval Range
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1572 - Matrix Diagonal Sum
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0149 - Maximum Points on a Line
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0048 - Rotate Image
โŒ
โŒ
0054 - Spiral Matrix
โŒ
โŒ
โŒ
โŒ
0059 - Spiral Matrix II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0073 - Set Matrix Zeroes
โŒ
โŒ
โŒ
โŒ
0202 - Happy Number
โŒ
โŒ
0066 - Plus One
โŒ
โŒ
0009 - Palindrome Number
โŒ
โŒ
โŒ
โŒ
0263 - Ugly Number
โŒ
โŒ
โŒ
โŒ
1260 - Shift 2D Grid
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0013 - Roman to Integer
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0012 - Integer to Roman
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0050 - Pow(x, n)
โŒ
โŒ
โŒ
โŒ
0043 - Multiply Strings
โŒ
โŒ
โŒ
โŒ
2013 - Detect Squares
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
1041 - Robot Bounded In Circle
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0006 - Zigzag Conversion
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2028 - Find Missing Observations
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

Bit Manipulation

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
0136 - Single Number
โŒ
0191 - Number of 1 Bits
โŒ
โŒ
0338 - Counting Bits
โŒ
โŒ
0190 - Reverse Bits
โŒ
โŒ
0268 - Missing Number
โŒ
โŒ
1470 - Shuffle the Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0989 - Add to Array-Form of Integer
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
0371 - Sum of Two Integers
โŒ
โŒ
0007 - Reverse Integer
โŒ
0067 - Add Binary
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

JavaScript

Problem C C++ C# Dart GO Java JS Kotlin Python Ruby Rust Scala Swift TS
2667 - Create Hello World Function
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2620 - Counter
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2665 - Counter II
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2635 - Apply Transform over each Element in Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2634 - Filter Elements from Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2626 - Array Reduce Transformation
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2629 - Function Composition
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2666 - Allow One Function Call
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2623 - Memoize
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2632 - Curry
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2621 - Sleep
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2637 - Promise Time Limit
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2636 - Promise Pool
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2622 - Cache With Time Limit
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2627 - Debounce
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2676 - Throttle
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2628 - JSON Deep Equal
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2633 - Convert Object to JSON String
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2675 - Array of Objects to Matrix
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2700 - Difference Between Two Objects
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2677 - Chunk Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2625 - Flatten Deeply Nested Array
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2619 - Array Prototype Last
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2631 - Group By
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2618 - Check if Object Instance of Class
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2693 - Call Function with Custom Context
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2694 - Event Emitter
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2695 - Array Wrapper
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2648 - Generate Fibonacci Sequence
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
2649 - Nested Array Generator
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ
โŒ

Need to update the README? Update the template instead.

leetcode's People

Contributors

a93a avatar aadil42 avatar aakhtar3 avatar agnihotriketan avatar ahmad-a0 avatar akifhanilgaz avatar ap-repositories avatar caba5 avatar chriskheng avatar felivalencia3 avatar imaginate avatar julienchemillier avatar loczek avatar mahim1997 avatar maratkhakim avatar mdmzfzl avatar mhamiid avatar miladra avatar mitchellirvin avatar neetcode-gh avatar notauserx avatar saip7795 avatar sharmatushar1 avatar sujal-goswami avatar tahsintunan avatar tedtran2019 avatar udaygarg avatar unresolvedcold avatar veerbia avatar ykhan799 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leetcode's Issues

Add an option to export and import progress

Currently, the progress on the site can be lost when the browser cache is cleared, browser is reinstalled, etc. I think it would be great if an export/import progress feature is added to the site, so that users can back up their progress. It would also be useful in cases like when a user wants to use the site in a different computer. They can export the progress in the old computer and import it in the new computer's browser to resume progress on the new machine.

Feature Request: Button to shuffle categories

It would be nice to be able to shuffle the categories. I mean only the categories, NOT the order of problems inside each category.
Normally, we could split our DSA interview study into 2 rounds:

  1. Learning with easy questions
    I think we shouldn't use this feature in this round.
  2. Practicing with medium then hard questions:
    In this round, randomness (emphasis, only categories, not the content inside each category) could be very helpful to many people like me, especially when combine with #336.

Suggestion: Neetcode 75 seperate tab

Any chance we could get a Neetcode 75 seperate tab (next to Neetcode 150 and Blind 75).
I've completed the Blind 75 and have moved on to Neetcode 150 and would like to keep seperate track of the completion of the list. A seperate tab would filter out the Blind 75 questions.

[FEATURE REQUEST] Pull Leetcode Status

Instead of having users manually confirm whether they have completed a problem from neetcode, you can offer a button to directly pull the data from the user's leetcode profile.

What type of license this repo has? Could you publish the LICENSE file to let know others how people can use the sources?

Hey guys, hi @neetcode-gh, awesome site! i find a lot of solutions very useful but can i share them with students on lectures or in youtube videos? The LICENSE file would be great to have to let know others how people can use the sources. Could you release one?

Github has great page dedicated to opensource licenses: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository

All the best!

Counter to show total problems solved

In addition to the number of problems solved per pattern/topic, I think it would be useful to have a total number of problems solved counter somewhere.

e.g. 34/150 on Neetcode 150; a sum of problems solved across all patterns.

Adding multiple solutions

Hey Neetcode, can i add different solutions to existing problems? If so, should i add the solution to the existing solution file?

For me personally, it really helps to look at different solutions to understand the problem completely.

Option to show/hide the category names

It would be nice to have a button to hide category names like below. This is even more helpful when combine with #339.

image

Currently, I use developer tools with this css:

body {
  counter-reset: category;
}

app-pattern-table app-accordion {
  counter-increment: category;
}

app-pattern-table app-accordion button.accordion::before {
  content: "Category " counter(category);
}

app-pattern-table app-accordion button.accordion > p:nth-child(1) {
  display: none;
}

[chore] folder/file naming conventions

we should pick a naming convention and update the entire repo to use that naming convention

currently for files we have a weird combination of Pascal-and-Spinal-Case

for the languages that have separated the neetcode 150 and the blind 75, we don't have a consistent convention for directory naming.

i'd propose moving to spinal-case across the board, but don't feel strongly about it. curious if anyone has strong opinions.

when we do the refactor, we should do it in chunks (maybe folder by folder) to make the PR reviews easier.

@neetcode-gh any preferences?

#286 Walls and Gates is missing initial for-loop

Missing logic after line 17, the queue q is currently always empty.

Here is the missing logic after line 17:

for r in range(ROWS):
    for c in range(COLS):
        if rooms[r][c] == 0:
            q.append([r, c])
            visit.add((r, c))

Code solutions differ from video.

It seems some solutions differ from the video, for 268-Missing-Number this code is shown in the video and appears as the python solution on neetcode.io:

class Solution:
    def missingNumber(self, nums: List[int]) -> int:
        res = len(nums)
        
        for i in range(len(nums)):
            res += (i - nums[i])
        return res

However the Java, C++ and proposed Typescript solution (#422) use slightly different algorithms:

Java:

class Solution {
    public int missingNumber(int[] nums) {
        int sum = 0;
        int total = nums.length * (nums.length+1)/2;
        for(int i = 0; i < nums.length; i++){
            sum += nums[i];
        }
        return total - sum;
    }
}

C++:

class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int n = nums.size();
        int result = n;
        for (int i = 0; i < n; i++) {
            result ^= i ^ nums[i];
        }
        return result;
    }
};

Typescript:

function missingNumber(nums: number[]): number {
  let sum: number = 0
  let total: number = (nums.length * (nums.length + 1)) / 2
  for (let i = 0; i < nums.length; i++) {
    sum += nums[i]
  }
  return total - sum
}

Not Included Problems.

Hey guys, I want to contribute to this amazing repo. But I have a question before I do that.
Can we put solutions to the questions that haven't been solved by the neetCode guy?
Sorry, I don't know your name so I said, neetCode guy.

Feature request: thumb-up/star

Can we get this feature so we can star the problems we think we need come back later to, or just are very interesting ๐Ÿค”

Enhancement: Notes section for each question

Adding a section for users to type notes (cached in the browser perhaps) would be very helpful. The notes section on the Blind 75 excel sheet that NeetCode created was super helpful. I would love the ability to write my own notes on how I solved the problems. Thanks!

Add time complexity to all solutions

In the walk through video's you go through the time and space complexity of any given problem.
I thought it would be nice if we added the time and space complexity on the site neetcode.io associated with each problem.

One approach could be to hard code it on the site.
Another rather simpler approach would be to have it in the github file with the code for each algorithm.

Other solutions

Hello @neetcode-gh, I wanted to ask you whether I should contribute by pushing solutions to leetcode questions that are not solved on the youtube channel. Thank you.

74-Search-A-2D-Matrix.java is not a Binary Search

The Java solution is a linear search and NOT a binary search. Worst case runtime for the code is O(m+n) which occurs if the target value is at the bottom left corner of the matrix. Binary search solution should be O(logm) + O(logn) as described in the video solution.

C# Solutions

In the future will it be possible to contribute C# solutions. I know the language is very similar to Java (although with many major differences) but as an engineer who is "all in" on Microsoft, .NET, and ASP it'd be nice to have C# solutions available. I'd be happy to contribute some as I learn.

Incorrect pattern for #121 (Best Time to Buy and Sell Stock)

Hi there!

I found the problem 121 (Best Time to Buy and Sell Stock) in "Sliding Window" section on neetcode.io

But in the video author is using "Two Pointers" pattern for his solution, not "Sliding Window".
So I believe this task should be moved to "Two Pointers" section.
I spent couple of hours trying to solve it with "Sliding Window" before I gave up, watched the video solution and found that we need another pattern here :(

36 Valid Sudoku fail for some invalid Sudoku

https://github.com/neetcode-gh/leetcode/blob/main/36-Valid-Sudoku.py

Is there a valid for

Solution().isValidSudoku(
    [
        ["9","2","3","4","5","6","7","8","."],
        [".",".",".",".",".",".","6","5","2"],
        [".",".",".",".",".",".",".","4","3"],
        [".",".",".",".",".",".","9",".","4"],
        [".",".",".",".",".",".",".",".","5"],
        [".",".",".",".",".",".",".",".","6"],
        [".",".",".",".",".",".",".",".","7"],
        [".",".",".",".",".",".",".",".","8"],
        [".",".",".",".",".",".",".",".","9"],
    ]
)

Lowest Common Ancestor of a BST

Since the question specifies a Binary Search Tree, and that q and p are nodes in the tree, the solution can be further simplified to be a search for the node whose value is between p and q

for instance

class Solution:
    def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
        if p.val <= root.val <= q.val or p.val >= root.val >= q.val:
            return root
        
        if p.val < root.val and q.val < root.val:
            return self.lowestCommonAncestor(root.left, p, q)
        else:
            return self.lowestCommonAncestor(root.right, p, q) 

Add leading zeros to file name to keep them in order

A neat little python script can add leading zero's to all the file names this way they will appear in order.
Something like this:

import sys,os,re

for file in sys.argv[1:]:
    if __file__ in file: continue
    number, name = file.split('-', 1)
    number = '{:0>4}'.format(number)
    new_name = f'{number}-{name}'
    os.rename(file,new_name)

PR #335 is the result of the above program.

Defect JS Solution: 102. Binary Tree Level Order Traversal

The provided Javascript solution for LeetCode 102. Binary Tree Level Order Traversal has a defect when the input array is an empty array

The error being returned is:

Line 23 in solution.js
            temp.push(subtree.val)
                              ^
TypeError: Cannot read properties of null (reading 'val')
    Line 23: Char 31 in solution.js (levelOrder)
    Line 42: Char 19 in solution.js (Object.<anonymous>)
    Line 16: Char 8 in runner.js (Object.runner)
    Line 33: Char 26 in solution.js (Object.<anonymous>)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Error
TestInput

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.