Skip to content

mohllal/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leetcode

LeetCode problems' solutions.

LeetCode Topics

Array

Problem Solution
3Sum Solution
3Sum Closest Solution
4Sum Solution
Array Partition Solution
Best Team With No Conflicts Solution
Best Time to Buy and Sell Stock Solution
Car Pooling Solution
Check If N and Its Double Exist Solution
Circular Array Loop Solution
Concatenated Words Solution
Container With Most Water Solution
Contains Duplicate Solution
Contains Duplicate II Solution
Daily Temperatures Solution
Delete Columns to Make Sorted Solution
Design Circular Queue Solution
Duplicate Zeros Solution
Evaluate Reverse Polish Notation Solution
Find All Numbers Disappeared in an Array Solution
Find Numbers with Even Number of Digits Solution
Find Pivot Index Solution
Find the Duplicate Number Solution
Find the Middle Index in Array Solution
Find the Town Judge Solution
Fruit Into Baskets Solution
Gas Station Solution
Get Maximum in Generated Array Solution
Height Checker Solution
Insert Interval Solution
Interval List Intersections Solution
Largest Number At Least Twice of Others Solution
Longest Increasing Subsequence Solution
Longest Mountain in Array Solution
Longest Path With Different Adjacent Characters Solution
Majority Element Solution
Max Consecutive Ones Solution
Max Consecutive Ones III Solution
Max Points on a Line Solution
Maximum Average Subarray I Solution
Maximum Ice Cream Bars Solution
Maximum Subarray Solution
Maximum Sum Circular Subarray Solution
Merge Intervals Solution
Merge Sorted Array Solution
Min Cost Climbing Stairs Solution
Minimum Number of Arrows to Burst Balloons Solution
Minimum Rounds to Complete All Tasks Solution
Minimum Size Subarray Sum Solution
Missing Number Solution
Monotonic Array Solution
Move Zeroes Solution
Non-decreasing Subsequences Solution
Number of Good Paths Solution
Pascal's Triangle Solution
Pascal's Triangle II Solution
Permutations Solution
Permutations II Solution
Plus One Solution
Remove Duplicates from Sorted Array Solution
Remove Element Solution
Replace Elements with Greatest Element on Right Side Solution
Rotate Array Solution
Search Insert Position Solution
Shortest Unsorted Continuous Subarray Solution
Single Number Solution
Sliding Window Median Solution
Snakes and Ladders Solution
Sort Array By Parity Solution
Sort Colors Solution
Sort the People Solution
Spiral Matrix Solution
Squares of a Sorted Array Solution
Subarray Sums Divisible by K Solution
Subsets Solution
Summary Ranges Solution
Third Maximum Number Solution
Two Sum Solution
Two Sum II - Input Array Is Sorted Solution
Valid Mountain Array Solution
Verifying an Alien Dictionary Solution

Backtracking

Problem Solution
Combinations Solution
Letter Combinations of a Phone Number Solution
Non-decreasing Subsequences Solution
Palindrome Partitioning Solution
Permutations Solution
Permutations II Solution
Restore IP Addresses Solution
Subsets Solution

Binary Search

Problem Solution
Arranging Coins Solution
Check If N and Its Double Exist Solution
Data Stream as Disjoint Intervals Solution
Find the Duplicate Number Solution
First Bad Version Solution
Longest Increasing Subsequence Solution
Max Consecutive Ones III Solution
Minimum Size Subarray Sum Solution
Missing Number Solution
Search Insert Position Solution
Sqrt(x) Solution
Two Sum II - Input Array Is Sorted Solution

Binary Tree

Problem Solution
Balanced Binary Tree Solution
Binary Tree Inorder Traversal Solution
Binary Tree Level Order Traversal Solution
Binary Tree Postorder Traversal Solution
Binary Tree Preorder Traversal Solution
Diameter of Binary Tree Solution
Invert Binary Tree Solution
Maximum Depth of Binary Tree Solution
Path Sum Solution
Same Tree Solution
Symmetric Tree Solution

Bit Manipulation

Problem Solution
Add Binary Solution
Counting Bits Solution
Find the Duplicate Number Solution
Missing Number Solution
Non-decreasing Subsequences Solution
Number of 1 Bits Solution
Power of Four Solution
Power of Two Solution
Single Number Solution
Subsets Solution

Breadth-First Search

Problem Solution
Binary Tree Level Order Traversal Solution
Cheapest Flights Within K Stops Solution
Clone Graph Solution
Invert Binary Tree Solution
Maximum Depth of Binary Tree Solution
Minimum Time to Collect All Apples in a Tree Solution
Number of Nodes in the Sub-Tree With the Same Label Solution
Path Sum Solution
Perfect Squares Solution
Same Tree Solution
Snakes and Ladders Solution
Symmetric Tree Solution

Counting

Problem Solution
First Unique Character in a String Solution
Majority Element Solution
Minimum Rounds to Complete All Tasks Solution
Number of Nodes in the Sub-Tree With the Same Label Solution
Ransom Note Solution
Substrings of Size Three with Distinct Characters Solution

Counting Sort

Problem Solution
Array Partition Solution
Height Checker Solution
Maximum Ice Cream Bars Solution

Data Stream

Problem Solution
Find Median from Data Stream Solution

Database

Problem Solution
Customers Who Never Order N/A
Delete Duplicate Emails Solution
Duplicate Emails Solution

Depth-First Search

Problem Solution
Balanced Binary Tree Solution
Binary Tree Inorder Traversal Solution
Binary Tree Postorder Traversal Solution
Binary Tree Preorder Traversal Solution
Cheapest Flights Within K Stops Solution
Clone Graph Solution
Concatenated Words Solution
Diameter of Binary Tree Solution
Find Closest Node to Given Two Nodes Solution
Invert Binary Tree Solution
Longest Path With Different Adjacent Characters Solution
Maximum Depth of Binary Tree Solution
Minimum Time to Collect All Apples in a Tree Solution
Number of Nodes in the Sub-Tree With the Same Label Solution
Path Sum Solution
Same Tree Solution
Symmetric Tree Solution

Design

Problem Solution
Data Stream as Disjoint Intervals Solution
Design Circular Queue Solution
Design Linked List Solution
Find Median from Data Stream Solution
LFU Cache Solution
Min Stack Solution

Divide and Conquer

Problem Solution
Majority Element Solution
Maximum Subarray Solution
Maximum Sum Circular Subarray Solution
Number of 1 Bits Solution

Doubly-Linked List

Problem Solution
LFU Cache Solution

Dynamic Programming

Problem Solution
Best Team With No Conflicts Solution
Best Time to Buy and Sell Stock Solution
Cheapest Flights Within K Stops Solution
Climbing Stairs Solution
Concatenated Words Solution
Counting Bits Solution
Fibonacci Number Solution
Flip String to Monotone Increasing Solution
Is Subsequence Solution
Longest Increasing Subsequence Solution
Longest Mountain in Array Solution
Maximum Subarray Solution
Maximum Sum Circular Subarray Solution
Min Cost Climbing Stairs Solution
N-th Tribonacci Number Solution
Palindrome Partitioning Solution
Pascal's Triangle Solution
Pascal's Triangle II Solution
Perfect Squares Solution

Enumeration

Problem Solution
Longest Mountain in Array Solution

Geometry

Problem Solution
Max Points on a Line Solution

Graph

Problem Solution
Cheapest Flights Within K Stops Solution
Clone Graph Solution
Find Closest Node to Given Two Nodes Solution
Find the Town Judge Solution
Longest Path With Different Adjacent Characters Solution
Number of Good Paths Solution

Greedy

Problem Solution
Array Partition Solution
Container With Most Water Solution
Gas Station Solution
Maximum Ice Cream Bars Solution
Minimum Number of Arrows to Burst Balloons Solution
Minimum Rounds to Complete All Tasks Solution
Shortest Unsorted Continuous Subarray Solution

Hash Table

Problem Solution
Check If N and Its Double Exist Solution
Circular Array Loop Solution
Clone Graph Solution
Contains Duplicate Solution
Contains Duplicate II Solution
Find All Anagrams in a String Solution
Find All Numbers Disappeared in an Array Solution
Find the Town Judge Solution
First Unique Character in a String Solution
Fruit Into Baskets Solution
Happy Number Solution
Letter Combinations of a Phone Number Solution
LFU Cache Solution
Linked List Cycle Solution
Linked List Cycle II Solution
Longest Repeating Character Replacement Solution
Longest Substring Without Repeating Characters Solution
Majority Element Solution
Max Points on a Line Solution
Minimum Rounds to Complete All Tasks Solution
Minimum Time to Collect All Apples in a Tree Solution
Minimum Window Substring Solution
Missing Number Solution
Non-decreasing Subsequences Solution
Number of Good Paths Solution
Number of Nodes in the Sub-Tree With the Same Label Solution
Permutation in String Solution
Ransom Note Solution
Roman to Integer Solution
Sliding Window Median Solution
Sort the People Solution
Subarray Sums Divisible by K Solution
Substrings of Size Three with Distinct Characters Solution
Two Sum Solution
Verifying an Alien Dictionary Solution
Word Pattern Solution

Heap (Priority Queue)

Problem Solution
Car Pooling Solution
Cheapest Flights Within K Stops Solution
Find Median from Data Stream Solution
Sliding Window Median Solution

Interactive

Problem Solution
First Bad Version Solution

Linked List

Problem Solution
Add Two Numbers Solution
Design Circular Queue Solution
Design Linked List Solution
LFU Cache Solution
Linked List Cycle Solution
Linked List Cycle II Solution
Merge Two Sorted Lists Solution
Middle of the Linked List Solution
Palindrome Linked List Solution
Reorder List Solution
Reverse Linked List Solution
Reverse Linked List II Solution
Reverse Nodes in k-Group Solution
Rotate List Solution
Swap Nodes in Pairs Solution

Math

Problem Solution
Add Binary Solution
Add Digits Solution
Add Two Numbers Solution
Arranging Coins Solution
Climbing Stairs Solution
Evaluate Reverse Polish Notation Solution
Fibonacci Number Solution
Find Numbers with Even Number of Digits Solution
Find the K-Beauty of a Number Solution
Greatest Common Divisor of Strings Solution
Happy Number Solution
Max Points on a Line Solution
Missing Number Solution
N-th Tribonacci Number Solution
Palindrome Number Solution
Perfect Squares Solution
Plus One Solution
Power of Four Solution
Power of Three Solution
Power of Two Solution
Roman to Integer Solution
Rotate Array Solution
Smallest Even Multiple Solution
Sqrt(x) Solution

Matrix

Problem Solution
Snakes and Ladders Solution
Spiral Matrix Solution

Memoization

Problem Solution
Climbing Stairs Solution
Fibonacci Number Solution
N-th Tribonacci Number Solution

Monotonic Queue

Problem Solution
Maximum Sum Circular Subarray Solution

Monotonic Stack

Problem Solution
Daily Temperatures Solution
Shortest Unsorted Continuous Subarray Solution

Number Theory

Problem Solution
Add Digits Solution
Smallest Even Multiple Solution

Ordered Set

Problem Solution
Data Stream as Disjoint Intervals Solution

Prefix Sum

Problem Solution
Car Pooling Solution
Find Pivot Index Solution
Find the Middle Index in Array Solution
Max Consecutive Ones III Solution
Minimum Size Subarray Sum Solution
Subarray Sums Divisible by K Solution

Queue

Problem Solution
Design Circular Queue Solution
First Unique Character in a String Solution
Maximum Sum Circular Subarray Solution

Recursion

Problem Solution
Add Two Numbers Solution
Fibonacci Number Solution
Merge Two Sorted Lists Solution
Palindrome Linked List Solution
Power of Four Solution
Power of Three Solution
Power of Two Solution
Reorder List Solution
Reverse Linked List Solution
Reverse Nodes in k-Group Solution
Swap Nodes in Pairs Solution

Shortest Path

Problem Solution
Cheapest Flights Within K Stops Solution

Simulation

Problem Solution
Add Binary Solution
Add Digits Solution
Backspace String Compare Solution
Car Pooling Solution
Get Maximum in Generated Array Solution
Spiral Matrix Solution

Sliding Window

Problem Solution
Contains Duplicate II Solution
Find All Anagrams in a String Solution
Find the K-Beauty of a Number Solution
Fruit Into Baskets Solution
Longest Repeating Character Replacement Solution
Longest Substring Without Repeating Characters Solution
Max Consecutive Ones III Solution
Maximum Average Subarray I Solution
Minimum Size Subarray Sum Solution
Minimum Window Substring Solution
Permutation in String Solution
Sliding Window Median Solution
Substrings of Size Three with Distinct Characters Solution

Sorting

Problem Solution
3Sum Solution
3Sum Closest Solution
4Sum Solution
Array Partition Solution
Best Team With No Conflicts Solution
Car Pooling Solution
Check If N and Its Double Exist Solution
Contains Duplicate Solution
Find Median from Data Stream Solution
Height Checker Solution
Largest Number At Least Twice of Others Solution
Majority Element Solution
Maximum Ice Cream Bars Solution
Merge Intervals Solution
Merge Sorted Array Solution
Minimum Number of Arrows to Burst Balloons Solution
Missing Number Solution
Number of Good Paths Solution
Shortest Unsorted Continuous Subarray Solution
Sort Array By Parity Solution
Sort Colors Solution
Sort the People Solution
Squares of a Sorted Array Solution
Third Maximum Number Solution

Stack

Problem Solution
Backspace String Compare Solution
Binary Tree Inorder Traversal Solution
Binary Tree Postorder Traversal Solution
Binary Tree Preorder Traversal Solution
Daily Temperatures Solution
Evaluate Reverse Polish Notation Solution
Min Stack Solution
Palindrome Linked List Solution
Reorder List Solution
Shortest Unsorted Continuous Subarray Solution
Valid Parentheses Solution

String

Problem Solution
Add Binary Solution
Backspace String Compare Solution
Concatenated Words Solution
Delete Columns to Make Sorted Solution
Detect Capital Solution
Find All Anagrams in a String Solution
Find the Index of the First Occurrence in a String N/A
Find the K-Beauty of a Number Solution
First Unique Character in a String Solution
Flip String to Monotone Increasing Solution
Greatest Common Divisor of Strings Solution
Is Subsequence Solution
Length of Last Word Solution
Letter Combinations of a Phone Number Solution
Lexicographically Smallest Equivalent String Solution
Longest Common Prefix Solution
Longest Path With Different Adjacent Characters Solution
Longest Repeating Character Replacement Solution
Longest Substring Without Repeating Characters Solution
Minimum Window Substring Solution
Number of Segments in a String Solution
Palindrome Partitioning Solution
Permutation in String Solution
Ransom Note Solution
Restore IP Addresses Solution
Reverse String Solution
Reverse Vowels of a String Solution
Reverse Words in a String Solution
Reverse Words in a String III Solution
Roman to Integer Solution
Sort the People Solution
Substrings of Size Three with Distinct Characters Solution
Valid Palindrome Solution
Valid Parentheses Solution
Verifying an Alien Dictionary Solution
Word Pattern Solution

String Matching

Problem Solution
Find the Index of the First Occurrence in a String N/A

Topological Sort

Problem Solution
Longest Path With Different Adjacent Characters Solution

Tree

Problem Solution
Balanced Binary Tree Solution
Binary Tree Inorder Traversal Solution
Binary Tree Level Order Traversal Solution
Binary Tree Postorder Traversal Solution
Binary Tree Preorder Traversal Solution
Diameter of Binary Tree Solution
Invert Binary Tree Solution
Longest Path With Different Adjacent Characters Solution
Maximum Depth of Binary Tree Solution
Minimum Time to Collect All Apples in a Tree Solution
Number of Good Paths Solution
Number of Nodes in the Sub-Tree With the Same Label Solution
Path Sum Solution
Same Tree Solution
Symmetric Tree Solution

Trie

Problem Solution
Concatenated Words Solution
Longest Common Prefix Solution

Two Pointers

Problem Solution
3Sum Solution
3Sum Closest Solution
4Sum Solution
Backspace String Compare Solution
Check If N and Its Double Exist Solution
Circular Array Loop Solution
Container With Most Water Solution
Duplicate Zeros Solution
Find Median from Data Stream Solution
Find the Duplicate Number Solution
Find the Index of the First Occurrence in a String N/A
Happy Number Solution
Interval List Intersections Solution
Is Subsequence Solution
Linked List Cycle Solution
Linked List Cycle II Solution
Longest Mountain in Array Solution
Merge Sorted Array Solution
Middle of the Linked List Solution
Move Zeroes Solution
Palindrome Linked List Solution
Permutation in String Solution
Remove Duplicates from Sorted Array Solution
Remove Element Solution
Reorder List Solution
Reverse String Solution
Reverse Vowels of a String Solution
Reverse Words in a String Solution
Reverse Words in a String III Solution
Rotate Array Solution
Rotate List Solution
Shortest Unsorted Continuous Subarray Solution
Sort Array By Parity Solution
Sort Colors Solution
Squares of a Sorted Array Solution
Two Sum II - Input Array Is Sorted Solution
Valid Palindrome Solution

Union Find

Problem Solution
Lexicographically Smallest Equivalent String Solution
Number of Good Paths Solution

About

LeetCode problems' solutions

Topics

Resources

Stars

Watchers

Forks

Languages