This repository contains the solutions to problems done from various resources for the upcoming interviews.
- Majority Element - Leetcode
- Find Numbers with Even number of digits - Leetcode
- Celebrity Problem - Leetcode
- Find Missing Number - Leetcode
- First Missing Positive Number - Leetcode
- Find numbers disappeared in an Array - Leetcode
- Find Duplicate in an Array - Leetcode
- Couples holding hands - Leetcode
- Rotate Array - Leetcode
- Remove duplicates from Sorted Array - Leetcode
- SnapShot Array - Leetcode
- Sparse Matrix Multiplication - Leetcode
- Diagonal Traverse - Leetcode
- Diagonal Traverse II - Leetcode
- Count Unhappy Friends - Leetcode
- Maximum Area of a piece of cake after Horizontal and Vertical Cuts - Leetcode
- Candy Crush - Leetcode
- Product of Array except Self - Leetcode
- Next Permutation - Leetcode
- Set Matrix Zeros - Leetcode
- Game of Life - Leetcode
- Basic Prefix Sum
- Zero Subarray Sum
- Number of Subarrays with Sum Equals K - Leetcode
- Maximum Size of Subarray Sum equals K - Leetcode
- Maximum Contiguous Array of 0 and 1 - Leetcode
- Subarray sum divisible by K - Leetcode
- Maximum Subarray size with sum less than K
- Maximum values after M range increments
- Maximum Occurred Integer from given ranges
- Two Sum on a Sorted Array - Leetcode
- Two Sum Less than K - Leetcode
- Two Sum with a BST - Leetcode
- Two Sum with Two BST - Leetcode
- Pair of Songs with Total Duration divisible by 60 - Leetcode
- Next Greater Element 3 - Leetcode
- Container with Most Water - Leetcode
- Squares of a Sorted Array - Leetcode
- Three Sum - Leetcode
- Three Sum closest to a target - Leetcode
- Number of Three Sum triplets lesser than a target - Leetcode
- Four sum - Leetcode
- Merge Sorted Arrays - Leetcode
- Intersection of Two Arrays - Leetcode
- Intersection of Three Sorted Arrays - Leetcode
- Sort Colors - Dutch National Flag - Leetcode
- Summary Ranges - Leetcode
- Partition List - Leetcode
- Partition Label - Leetcode
- Number of Unique pairs having a difference of K - Leetcode
- Backspace String Compare - Leetcode
- Shortest Unsorted Contiguous Subarray - Leetcode
- Naive way to solve a sliding window problem
- Maximum sum with subarray of size K
- Minimum sum with subarray of size K
- First Negative Number in every window of size K
- Find all Anagrams of a String - Leetcode
- Find the maximum value of all subarray of size k - Leetcode
- Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit - Leetcode
- Longest subarray with sum of the elements equal to the given value K for positive integer array
- Number of Subarrays with product < K - Leetcode
- Longest substring with K Distinct Characters
- Longest substring with No Repeating Characters - Leetcode
- Longest substring with At Most Two Distinct Characters - Leetcode
- Longest substring with At Most K Distinct Characters - Leetcode
- Minimum size of Subarray with sum >= K - Leetcode
- Minimum Window Substring containing all characters of a given string - Leetcode
- Longest Repeating Character Replacement - Leetcode
- Longest subarray of consecutive 1's by replacing at most K 0's - Leetcode
- Longest substring with At Least K repeating characters - Leetcode
- Sliding Window Median - Leetcode
- Maximum Points Cards - Leetcode
- Maximum Contiguous Array of 0 and 1 - Leetcode
- Substring with Concatenation of all words
- Fruits into Baskets
- Merge Sort
- Merge Sorted Arrays - Leetcode
- Merge Two Sorted Lists - Leetcode
- Maximum Subarray - Leetcode
- Count the number of inversions
- Global and Local Inversions - Leetcode
- Reverse Pairs - Leetcode
- Count of Numbers Smaller than Self - Leetcode
- Kth largest element in an array - Leetcode
- K Closest Points to Origin - Leetcode
- Top K frequent elements - Leetcode
- Number of Ships in a Rectangle - Leetcode
- Binary Search - Leetcode
- Two Sum on a Sorted Array - Leetcode
- Play the Guessing Game - Leetcode
- Median of two Sorted Array - Leetcode
- Order Agnostic Binary Search
- First and Last Position of an Element in a Sorted Array - Leetcode
- Find the count of an element in a Sorted Array
- Find minimum in a Rotated Sorted Array - Leetcode
- Find minimum in a Rotated Sorted Array with duplicate numbers - Leetcode
- Search in a Rotated Sorted Array - Leetcode
- Search in a Rotated Sorted Array with Duplicates - Leetcode
- Search in an Infinite Sorted Array - Leetcode
- Find element in an Almost Sorted Array
- Find the Ceil of a number in a sorted array - Leetcode
- Sqrt of a number - Leetcode
- Find the smallest next letter greater than the target - Leetcode
- First Bad Version - Leetcode
- Minimum Difference element in a sorted array
- Peak Element - Leetcode
- Find Maximum in a Bitonic Array
- Search in a Bitonic array
- Find in Mountain Array - Leetcode
- Search in a Matrix Sorted Row-wise and Column-wise - Leetcode
- Search in a Matrix Sorted Row-wise and 1st number of a row is greater than the last number of the previous row - Leetcode
- Find kth smallest element in a sorted matrix - Leetcode
- Find Single Element in a Sorted Array - Leetcode
- Build a weighted sampler API - Leetcode
- Timestamp based Key Value Storage - Leetcode
- Kth Missing Positive Number - Leetcode
- Find K closest elements to a number in a Sorted Array - Leetcode
- Add Two Numbers - Leetcode
- Add Two Numbers, where numbers are given from MSB to LSB - Leetcode
- Multiply Strings - Leetcode
- Reverse a Linked List - Leetcode
- Reverse a Linked List from Node m to Node n - Leetcode
- Reverse Nodes in k group - Leetcode
- Merge Two Sorted Lists - Leetcode
- Copy List with Random Pointer - Leetcode
- Rotate a Linked List by k positions - Leetcode
- Remove duplicates from Sorted List - Leetcode
- Remove duplicates from Sorted List II - Leetcode
- Flatten a multilevel Doubly Linked List - Leetcode
- Insert into a Sorted Circular Linked List - Leetcode
- Odd Even Linked List - Leetcode
- Detect a Cycle in a Linked List and return its starting point - Leetcode
- Middle of a Linked List - Leetcode
- Intersection of Two LinkedList - Leetcode
- Check for Palindrome Linked List = Leetcode
- Sort a Linked List - Leetcode
- Reorder a Linked List - Leetcode
- Delete Nth Node from the End of the Linked List - Leetcode
- Two Sum with a BST - Leetcode
- Two Sum with Two BST - Leetcode
- Monotonic Stack - Increasing and Decreasing
- Daily Temperature - Leetcode
- Next Greater Element 1 - Leetcode
- Next Greater Element 2 - Leetcode
- Stock Span - Leetcode
- Find 132 Pattern - Leetcode
- Sum of Subarray Minimums - Leetcode
- Largest Rectangle in Histogram - Leetcode
- Maximum Rectangle in a Binary Matrix - Leetcode
- Maximum Width Ramp - Leetcode
- Trapping Rain Water - Leetcode
- Min Stack in O(1) space - Leetcode
- Incremental Stack - Leetcode
- Valid Parenthesis - Leetcode
- Minimum Remove to Make Valid Parenthesis - Leetcode
- Longest Valid Parenthesis - Leetcode
- Basic Calculator with +, - and () functionality - Leetcode
- Basic Calculator with +, -, * and / functionality - Leetcode
- Basic Calculator with +, -, *, and . with () functionality - Leetcode
- Decode a given string - Leetcode
- Flatten a Nested List Iterator - Leetcode
- Exclusive Running Time of Functions -Leetcode
- Asteroid Collision - Leetcode
- Remove all adjacent duplicates in a string- Leetcode
- Remove all adjacent duplicates in a string II - Leetcode
- Array Subset
- Find Symmetric pairs in an array
- Check if arrays are disjoint
- Zero Subarray Sum
- First Unique Character in a String - Leetcode
- Length of Longest Palindrome - Leetcode
- Check if permutation of string is a palindrome - Leetcode
- Intersection of Two Arrays - Leetcode
- Rolling Hash
- Repeated DNA Sequence - Leetcode
- Find Pairs in an array with equal sum
- Two Sum - Leetcode
- Subarray Sum Equals K - Leetcpde
- Two Sum Design - Leetcode
- Maximum Contiguous Array of 0 and 1 - Leetcode
- Maximum Size Subarray Sum equals K - Leetcode
- Sort Characters by Frequency - Leetcode
- Fraction to Recurring Decimal - Leetcode
- Verifying an Alien Dictionary - Leetcode
- Design HashSet - Leetcode
- Design HashMap - Leetcode
- Design TinyUrl - Leetcode
- Design Logger Rate Limiter - Leetcode
- Design File System - Leetcode
- Isomorphic Strings - Leetcode
- Minimum Area Rectangle - Leetcode
- Minimum Index Sum of Two Lists - Leetcode
- Prison Cells after N days - Leetcode
- Group Anagrams
- Insert Delete GetRandom in O(1)
- Group Shifted Strings - Leetcode
- Dot Product of Sparse Vectors - Leetcode
- Longest String Chain
- Data Stream as Disjoint Intervals
- Analyze user website pattern
- High Five
- Design a LeaderBoard
- Kth largest element in an array - Leetcode
- Sort an almost Sorted Array
- K closest elements in an Unsorted Array
- Top K frequent elements - Leetcode
- Sort Array by Increasing Frequency - Leetcode
- K Closest Points to Origin - Leetcode
- Minimum Cost to Connect Sticks - Leetcode
- Top K frequent words - Leetcode
- Least Number of Unique Integers After K removals - Leetcode
- Sum of elements between k1 and k2 smallest elements
- Find K Pairs with Smallest Sums - Leetcode
- Merge K Sorted Lists - Leetcode
- Smallest Range covering elements from K elements - Leetcode
- Find kth smallest element in a sorted matrix - Leetcode
- Reorganize String - Leetcode
- Rearrange String such that same characters are at least K distance apart - Leetcode
- Task Scheduler - Leetcode
- Maximum Frequency Stack - Leetcode
- Employee Free Time - Leetcode
- Design Twitter - Leetcode
- Minimum Number of Refueling Stops - Leetcode
- Find K closest elements to a number in a Sorted Array - Leetcode
- Maximum Performance of a Team - Leetcode
- Median of a Data Stream - Leetcode
- Maximize Capital for an IPO - Leetcode
- Find Right Interval - Leetcode
- First Unique Character in a String - Leetcode
- Maximum Nesting Depth of Parenthesis - Leetcode
- Minimum number of steps to make two strings anagram - Leetcode
- Invalid Transactions - Leetcode
- Count and Say Sequence - Leetcode
- String Compression - Leetcode
- Text Justification - Leetcode
- Maximum Length of a Concatenated String with Unique Characters - Leetcode
- Reverse Words in a String - Leetcode
- Implement Trie (Prefix Tree) - Leetcode
- Map Sum Pairs - Leetcode
- Replace Words - Leetcode
- Maximum XOR of Two Numbers in an Array - Leetcode
- Stream of Characters - Leetcode
- Design a Add and Search words Data Structure - Leetcode
- Word Search from a Grid II - Leetcode
- Design Search Autocomplete System - Leetcode
- Merge Intervals - Leetcode
- Insert Interval - Leetcode
- Interval List Intersection - Leetcode
- Meeting Rooms - Leetcode
- Meeting Rooms II - Leetcode
- Meeting Scheduler - Leetcode
- Maximum CPU Load at any point of time
- Partition Label - Leetcode
- Design Underground System - Leetcode
- Design a LRU Cache - Leetcode
- Design a LFU Cache - Leetcode
- Design Browser History - Leetcode
- Design a LeaderBoard - Leetcode
- Min Stack in O(1) space - Leetcode
- Binary Search Tree Iterator - Leetcode
- Design Hit Counter - Leetcode
- Design Bounded Blocking Queue - Leetcode
- Kill Process - Leetcode
- Design Search Autocomplete System - Leetcode
- Design a system to get the First Unique number - Leetcode
- Design Tic-Tac-Toe - Leetcode
- Design Snake Game - Leetcode
- Design a Add and Search words Data Structure - Leetcode
- Design a Peeking Iterator - Leetcode
- Print Natural Numbers upto N
- Print Natural Numbers upto N in reverse order
- Sort a Stack
- Delete middle element of a stack
- Reverse a Stack without extra memory
- Kth Symbol in Grammar - Leetcode
- Maximum Length of a Concatenated String with Unique Characters - Leetcode
- Binary Tree Level Order Traversal - Leetcode
- Invert a Binary Tree - Leetcode
- Binary Tree Bottom Up Level Order Traversal - Leetcode
- Binary Tree Zigzag Level Order Traversal - Leetcode
- Average of Levels in Binary Tree - Leetcode
- Minimum Depth of a Binary Tree - Leetcode
- Right Side View of a Binary Tree - Leetcode
- Connect Siblings in a level of a Perfect Binary Tree - Leetcode
- Find Bottom Left Tree value - Leetcode
- Find Maximum in each level of a binary tree - Leetcode
- Maximum width of a Binary Tree - Leetcode
- Even Odd Tree - Leetcode
- Flip Equivalent Binary Trees - Leetcode
- Time taken to inform all employees in a company - Leetcode
- Clone Binary Tree with Random Pointer - Leetcode
- Height of a Binary Tree - Leetcode
- Binary Tree Paths - Leetcode
- Path Sum : Check if a path from root to leaf exists with given sum - Leetcode
- Path Sum II : Return all paths from root to leaf with given sum - Leetcode
- Path Sum III : Return all paths with a given sum (Need not be root to leaf) - Leetcode
- Sum of Path as Numbers - Leetcode
- Find Good Nodes in a Binary Tree - Leetcode
- Maximum Path Sum - Leetcode
- Diameter of a Binary Tree - Leetcode
- Longest Univalue Path - Leetcode
- Boundary of a Binary Tree - Leetcode
- Find leaves of Binary Tree - Group leaves of same level together - Leetcode
- Binary Tree Inorder Traversal - Leetcode
- Construct Binary Tree from Preorder and Inorder Traversal - Leetcode
- Vertical Order Traversal of a Binary Tree - Leetcode
- Check of Same Tree - Leetcode
- Check subtree of another tree - Leetcode
- Count univalue subtrees - Leetcode
- Calcuate Size of Subtree
- Check for Symmetric Tree - Leetcode
- Invert a Binary Tree - Leetcode
- Lowest Common Ancestor of Binary Tree - Leetcode
- Lowest Common Ancestor of Binary Tree with Parent Connection - Leetcode
- Serialize and Deserialize a Binary Tree - Leetcode
- Find duplicate subtrees - Leetcode
- Maximum Average Subtree - Leetcode
- All nodes at distance K in a Binary Tree - Leetcode
- Distribute Coins in Binary Tree - Leetcode
- Binary Tree Cameras - Leetcode
- Insert into a Binary Search Tree - Leetcode
- Validate Binary Search Tree - Leetcode
- Largest BST Subtree - Leetcode
- Binary Search Tree Iterator - Leetcode
- Range sum BST - Leetcode
- Closest Value to target in BST - Leetcode
- Convert a BST to Sorted Circular DLL - Leetcode
- Recover Binary Search Tree - Leetcode
- N-Queen - Leetcode
- Sudoku Solver - Leetcode
- Subsets of all given unique elements - Leetcode
- Subsets of all numbers with duplicates - Leetcode
- Permutation of all given unique elements - Leetcode
- Permutation of all given numbers that may contain duplicates - Leetcode
- Letter Case Permutation - Leetcode
- Letter Combination of a Phone Number - Leetcode
- Generate all combinations of parenthesis - Leetcode
- Restore IP Address - Leetcode
- Combination Sum with elements allowed to be reused - Leetcode
- Combination Sum with no reuse of elements - Leetcode
- Android Unlock Patterns - Leetcode
- Count Sorted Vowel Strings - Leetcode
- All Paths from Source to Target - Leetcode
- Generalized Abbreviation - Leetcode
- Letter Combination of a Phone Number - Leetcode
- Word Search from a Grid - Leetcode
- Word Search from a Grid II - Leetcode
- Word Break II : Give all possible sentences that can be constructed - Leetcode
- Word Pattern II : Bijective Mapping of a String to a pattern - Leetcode
- Design a Add and Search words Data Structure - Leetcode
- Number of unique paths from start to end, visiting every non-blocking cell - Leetcode
- Maximum length of concatenated string with Unique Characters - Leetcode
- Graph Adjacency List Representation
- Depth First Search Recursive
- Depth First Search Iterative
- Breadth First Search Recursive
- Breadth First Search Iterative
- Clone Graph - Leetcode
- Maximal Network Rank - Leetcode
- Minimum Number of Vertices to reach all nodes - Leetcode
- Graph Valid Tree - Leetcode
- Number of Islands - Leetcode
- Pacific Atlantic Water Flow - Leetcode
- Number of Distinct Islands - Leetcode
- Maximum Area of an Island - Leetcode
- Surrounded Regions - Leetcode
- Walls and Gates - Leetcode
- Number of Provinces - Leetcode
- Merge Accounts with same email id - Leetcode
- Evaluate Division Query - Leetcode
- Longest Increasing Path in a Matrix - Leetcode
- All Paths from Source to Target - Leetcode
- Remove Invalid Parenthesis - Leetcode
- Number of Islands - Leetcode
- Rotten Oranges - Leetcode
- Employee Importance - Leetcode
- Kill Process - Leetcode
- Nested List Weight Sum - Leetcode
- Open the Lock - Leetcode
- Minimum Knight Moves - Leetcode
- Word Ladder - Leetcode
- Word Ladder II : Generate all possible transformation sequences - Leetcode
- Snakes and Ladders - Leetcode
- Shortest path in a Binary Matrix - Leetcode
- Shortest Path in a grid with Obstacle Elimination - Leetcode
- Count the number of connected components
- Number of connected components in an Undirected Graph - Leetcode
- Number of Operations to connect the network - Leetcode
- Minimum Degree of a connected Trio in a Graph - Leetcode
- Topological Sort
- Kahn's Algorithm
- Alien Dictionary - Leetcode
- Reconstruct Itinerary - Leetcode
- Minimum Height Trees - Leetcode
- Course Schedule - Leetcode
- Course Schedule Ordering using BFS - Leetcode
- Union Find Algorithm with Path Compression
- Identifying Redundant Connections - Leetcode
- Identifying Redundant Connection in a Directed Graph - Leetcode
- Connecting Cities with Minimum Cost - Leetcode
- Longest Consecutive Sequence - Leetcode
- 0-1 Knapsack Problem
- Subset Sum
- Partition Equal Subset Sum - Leetcode
- Count number of subsets with given sum
- Target Sum - Leetcode
- Minimize Subset Sum difference
- Unbounded Knapsack
- Rod Cutting
- Coin Change : Number of ways to make an Amount - Leetcode
- Coin Change : Minimum number of coins to make an Amount - Leetcode
- Minimum number of ways to make a number with perfect squares - Leetcode
- Number of Dice rolls with Target Sum - Leetcode
- Fibonacci Numbers - Leetcode
- Climb Stairs - Leetcode
- Unique Paths : Basic - Leetcode
- Unique PathsII : with obstacles in the grid - Leetcode
- Decode a string into possible ways - Leetcode
- House Robber - Leetcode
- House Robber : Houses are arranged in a circle - Leetcode
- House Robber : Houses are arranged as a Binary Tree - Leetcode
- Buy and Sell Stock - Leetcode
- Buy and Sell StockII : Allow Multiple transaction - Leetcode
- Buy and Sell StockIII : Only Two Transactions Allowed - Leetcode
- Buy and Sell StockIV : K Transactions Allowed - Leetcode
- Longest Palindromic Subsequence - Leetcode
- Longest Palindromic Substring - Leetcode
- Count number of Palindromic Substrings - Leetcode
- Minimum number of deletions to make a palindrome
- Palindromic Partition - Leetcode
- Minimum Cuts needed for Palindromic Partition - Leetcode
- Word Break - Leetcode
- Concatenated Words - Leetcode
- Count Sorted Vowel Strings - Leetcode
- Partition Array for Maximum sum - Leetcode
- Filing Bookcase shelves - Leetcode
- Edit Distance - Leetcode
- Regular Expression Matching- Leetcode
- Minimum Path Sum - Leetcode
- Minimum Falling Path Sum - Leetcode
- Maximal Square - Leetcode
- Count Square Submatrices with all Ones - Leetcode
- Burst Balloons - Leetcode
- Minimum Difficulty of a Job Schedule - Leetcode
- Maximum Profit in Job Scheduling - Leetcode
- Minimum Cost Tree from Leaf Values - Leetcode
- Out of Boundary Paths - Leetcode
- Knight Probability in Chess Board - Leetcode
- Range Sum Query 2D - Immutable - Leetcode
- Maximum Score from performing Multiplication Operations - Leetcode
- Maximum units on a Truck - Leetcode
- Two City Scheduling - Leetcode
- Queue Reconstruction by Height - Leetcode
- Gas Station - Leetcode
- Jump Game - Leetcode
- Jump Game II - Leetcode
- Minimum Deletions to make character frequencies unique - Leetcode
- Remove Duplicate Letters - Leetcode
- Remove K Digits such that new number is smallest possible - Leetcode
- Minimum Deletion Cost to Avoid Repeating Letters - Leetcode
- Video Stitching - Leetcode
- Sell Diminishing values coloured balls - Leetcode
- Maximum Performance of a Team - Leetcode
- Divide Array in Sets of K Consecutive Numbers - Leetcode
- Hand of Straights - Leetcode