java-leetcode
My daily LeetCode solutions. Solutions were added on daily basis after i solved each problem.
The solutions were written while I was solving these problems during practice, therefore while the solutions were accepted in LeetCode on Submission, they may not represent the best solution and the source codes may not be optimized
Day 1 - Easy
- Array Partition I
- Big Countries
- Distribute Candies
- Hamming Distance
- Merge Two Binary Trees
- Number Complement
- Reshape the Matrix
- Reverse String
- Reverse Words in String III
- Swap Salary
Day 1 - Medium
- Battleships in a A Board
- Binary Search Tree Iterator
- Binary Tree Preorder Traversal
- Complex Number Multiplication
- Find Duplicate File in System
- Single Element in Sorted Array
- Sort Characters by Frequency
- Spiral Matrix
- Spiral Matrix II
- Top K Frequent Items
Day 2 - Easy
- Average Of Levels In Binary Tree
- Detect Capitals
- Find All Numbers Disappear in Array
- FizzBuzz
- Invert Binary Tree
- Island Parameter
- Max Consecutive Ones
- Next Greater Element
- Not Boring Movies
- Single Number
- Sum of Two Integers
Day 2 - Medium
- Add One Row To Tree Node
- Array Nesting
- Count Bits
- Find All Duplicates in Array
- Find Bottom Left Tree Value
- Friend Circles
- Inorder Traversal
- Largest Value in Each Tree Row
- Shuffle an Array
- Single Number III
- Total Hamming Distance
Day 3 - Easy
- Binary Tree Tilt
- Contains Duplicates
- Excel Sheet Column Numbers
- Find Unique Characters in String
- Majority Element
- Relative Ranks
- Reverse Linked List
- Same Trees
- Sum of Left Leaves
- Valid Anagram
Day 3 - Medium
Day 4 - Easy
- Base 7
- Convert Sorted Array to Binary Search Tree
- Diameter of Binary Tree
- Maximum Product of 3 Numbers
- Missing Number
- Number of Boomerangs
- Read Binary Watch
- Reverse String II
- Student Attendance Record II
Day 4 - Medium
- Binary Tree Paths
- Binary Tree Right Side View
- Clone Graph
- Binary Tree to Linked List
- Number of Islands
- Subarray Sum equals to K
- Subsets
- Sum Root to Leaf Numbers
- Symmetric Tree
- Target Sum
Day 4 - Hard
Day 5 - Easy
- Excel Sheet Column Title
- Linked List Cycle
- Longest Common Prefix
- Merge Two Sorted Lists
- Min Stack
- Panlindrome Number
- Reverse Integer
- Roman to Integer
- Second Highest Salary
- Sqrt(x)
- Valid Parentheses
Day 5 - Medium
- Generate Parentheses
- Integer to Roman
- Kth Largest Element in an array
- Letter Combinations of Phone Number
- Longest Panlindrome Substring
- Longest Substring without Repeating Characters
- Nth Highest Salary
- Remove Nth Node from End of List
- String to Integer
- Zig Zag Conversion
Day 6 - Easy
- Remove duplicates from sorted array
- Maximum Subarray
- Remove Element
- Implement strStr()
- Search Insert Position
- Count And Say
- Length of Last Word
- Plus One
- Add Binary
- Climb Stairs
- Remove Duplicates from Sorted List
- Merge Sorted Array
- Path Sum
- Pascal's Triangle
- Pascal's Triangle II
- Binary Level Order Traversal II
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock II
- Valid Panlindrome
- Intersection of Two Linked Lists
Day 6 - Medium
- Swap Nodes in Pairs
- Search for a Range
- Search In Rotated Sorted Array
- Set Matrix Zeroes
- Sort Colors
- Group Anagrams
- Binary Tree Level Order Traversal
- Reverse Words in a String
- Linked List Cycle II
- Repeated DNA Sequence
Day 7 - Easy
- Two Sums - Input Array is Sorted
- Factorial Trailing Zeroes
- Employees earning more than their Managers
- Find Duplicate Emails
- Find Customers who never orders
- Rotate Array
- Reverse Bits
- Number of 1 Bits
- Valid Phone Numbers
- 10th Line
- Delete Duplicate Emails
- Rising Temperature
- House Robber
- Happy Number
- Remove Linked List Elements
- Contains Duplicates II
- Implement Stack using Queues
- Implement Queue using Stacks
- Power of Two
- Count Primes
- Panlindrome Linked List
- Add Digits
Day 7 - Medium
- Remove Duplicates from Sorted Array II
- Multiply Strings
- Word Search
- Simplify Path
- Search in Rotated Sorted Array II
- Permutations II
- Combination Sum
- Valid BST
- Unique Binary Search Trees
- Combinations
- Rotate List
Day 8 - Easy
- Ugly Number
- Delete Node in a Linked List
- Lowest Common Ancestor of a Binary Search Tree
- Find the difference
- Ransom Note
- Nth Digit
- Convert to Hexadecimal
- Add Strings
- Longest Panlindrome
- Third Max
- Number of Segments in a String
Day 8 - Medium
Day 9 - Easy
- Move Zeroes
- Nim Game
- First Bad Version
- Reverse Vowels in a String
- Range Sum Query
- Power of Three
- Power of Four
- Valid Perfect Square
- Intersection of Two Arrays
- Intersection of Two Arrays II
- Guess Number High Or Low
Day 9 - Medium
Day 10 - Easy
- Find All Anagrams
- Construct String from Binary Search Tree
- Set Mismatch
- Sum of Square Numbers
- Max Average Sub Array
- Can Place Flowers
- Minimum Index Sum
- Classes with more than 4 Students
- Heaters
- Convert BST to Greater Tree
- Subtree of Another Tree
Day 10 - Medium
Day 11 - Easy
Day 11 - Medium
Day 11 - Hard
Day 12 - Easy
Day 12 - Medium
Day 14 - Easy
- Rearranging Coins
- Longest Harmonious Sequence
- Find Model in Binary Search Tree
- Shortest Unsorted Continuous Subarray
- Minimum Absolute Difference in BST
- K-diff Pairs in Array
- Minimum Moves to Equal Array Elements
- Assign Cookies
- Keyboard Row
- Poor Pigs
Day 14 - Medium
Day 15 - Medium
- Count Numbers with Unique Digits
- 2 Keys Keyboard
- Dota2 Senate
- Replace Words
- Maximum Length of Pair Chain
- Solve The Equation
- Permutation in String
- Continuous Subarray Sum
- Continuous Array
- Minesweeper
- Integer Break
- Shopping Offers
- Minimum Path Sum
- Unique Paths
- Unique Paths II
- Search a 2D Matrix
- Search a 2D Matrix II
- Find the Duplicate Number
- Exclusive Time of Functions
- Exchange Seats
Day 16 - Medium
- Delete Node in a BST
- Task Scheduler
- Valid Triangle Number
- Valid Square
- Fraction to Recurring Decimal
- Rectangle Area
- Next Greater Element III
- Next Greater Element II
- Decode String
- Flatten Nested List Iterator
- MiniParser
- Minimum Time Difference
- 01 Matrix
- Sort List
- Insertion Sort List
- Copy List With Random Pointer
- Reconstruct Original Digits from English
Day 17 - Medium
- Diagonal Traversal
- Arithmetic Slices
- Fraction Addition and Subtraction
- Encode and Decode TinyURL
- Convert Sorted List to Binary Tree
- Verify Preorder Serialization of a Binary Tree
- Evaluate Reverse Polish Notation
- Partition List
- Reorder List
- Odd Even Linked List
- 3 Sum
- 3 Sum Closest
- Lexicographical Numbers
- Random Pick Index
- Linked List Random Node
- Evaluate Division
- Course Schedule
- Brick Wall
- Rank Scores
- Consecutive Numbers
Day 18 - Easy
Day 18 - Medium
- Beautiful Arrangement
- Peeking Iterator
- License Key Formatting
- Validate IP Address
- Find K Closest Element
- Validate UTF-8
- Kth Smallest Element in a BST
- Serialize and Deserialize BST
- Find Duplicate Subtrees
- Longest Absolute File Path
- Maximum Product of Word Length
- Single Number II
- Word Ladder
- Lowest Common Ancestor of Binary Tree
- Course Schedule II
- Summary Ranges
- Word Frequency
- Department Highest Salary
- Populating Next Right Pointer in Each Node
- Find Minimum in Rotated Sorted List
Day 19 - Easy
- Path Sum III
- Minimum Moves to Equal Array Elements
- Repeated Substring Patterns
- Largest Panlindrome Product
Day 19 - Medium
Day 20 - Hard
Day 20 - Medium
- Longest Substring with at least k Repeating Characters
- Pacific Atlantic Water Flow
- Implement Trie (Prefix Trie)
- Add and Search Word - Word Dictionary Design
Day 21 - Medium
- Largest Divisible Subset
- Partition Equal Subset Sum
- Permutation Sequence
- Next Permutation
- H-Index
- H-Index II
Day 25 - Easy
- [Image Smoother]
Day 25 - Medium
- [Equal Tree Partition]
- [Maximum Width of Binary Tree]