Collection of Hundreds of Data Structures and Algorithms Problems and Solutions
Collection of hundreds of Data Structure and Algorithms Problems and solutions from different sources, including leetcode.com, hackerrank.com, pramp, Cracking The Coding Interview, Glassdoor, and real-world interviews from top-tier tech companies including Amazon, Facebook, Google, LinkedIn, Twitter, Microsoft.
-
The question descriptions, the solutions, and their implementation are as follows:
- 2 Sum Problem
- 2 Sum Problem II - find all pairs with the difference of K.
- 3 Sum Problem
- 3 Sum Closest
- 4 Sum Problem
- Activity Selection Profit
- Add Binary
- Add Digits
- Add Strings
- Add Two Numbers
- Additive Numbers
- Adjacent Character Remove
- Anagram Closer
- Anagram Consecutive
- Animal Queue
- Arithmetic Slices
- Array 3 Sum with Multiplicity
- Array Contiguous Sub Array With Sum K Count
- Array Difference
- Array Division to Three Stacks
- Array Duplicate
- Array Duplicate II
- Array Duplicate III
- Array Duplicate Number
- Array Equillibrium Pivot Index
- Array Equillibrium Point
- Array Even Odd Sorting
- Array Find Minimum In Rotated Sorted Array
- Array First and Last Position
- Array GCD Finding
- Array Get Different Number
- Array Increasing Triplet Sequence
- Array Index Element Equality
- Array Intersection
- Array K Difference Pairs
- Array Kth Largest Element
- Array Largest Number Combination
- Array Max Increasing Index
- Array Max Product Three Numbers
- Array Maximum Product SubArray
- Array Maximum Sum SubArray
- Array Missing Number
- Array Product of Array Except Self
- Array Parity Ordering
- Array Partition I
- Array Peak Element
- Array Product Except Self
- Array Product SubArray Less than K
- Array Remove Alternate Duplicate Characters
- Array Search in Rotated Sorted Array
- Array Search in Rotated Sorted Array II
- Array Search Unknown Size
- Array Shortest Unsorted SubArray
- Array Single Duplicate
- Array Stream Kth Largest
- Array Subset Partition Almost Equal Sum
- Array Subset Partition Equal Sum
- Array Subset Sum
- Array Subsets
- Array Subsets Duplicate Elements
- Array Three Keys Sorting
- Array Top K Frequent Elements
- Array Two Missing Numbers
- Array With Single Entry
- Assign Cookies
- Balanced Binary Tree
- Base Conversion
- Best Time To Buy and Sell Stock
- Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock III
- Best Time to Buy and Sell Stock IV
- Best Time to Buy and Sell Stock with Cooldown
- Best Time to Buy and Sell Stock with Transfer Fee
- BFS Tree Traversal (Breadth First Search Tree Traversal)
- Binary Tree Check if Binary Search Tree
- Binary Search
- Binary Search Tree from Sorted Array
- Binary Search Tree Iterator
- Binary Search Tree Kth Smallest Element
- Binary Search Tree Inorder Successor
- Binary Tree Common Ancestor
- Binary Tree Extract Leaf Nodes to Doubly Linked List
- Binary Tree From Preorder and Inorder String
- Binary Tree Inorder Traversal
- Binary Tree K Nodes Apart
- Binary Tree Level Order Traversal
- Binary Tree Level Order Traversal II
- Binary Tree Linked List Level
- Binary Tree Maximum Depth
- Binary Tree Paths
- Binary Tree Path Sum Root Node
- Binary Tree Path Sum Starting and Ending AnyWhere
- Binary Tree Postorder Traversal
- Binary Tree Preorder Traversal
- Binary Tree Root to Leaf Path Sum Check
- Binary Tree Root to Leaf Sum All Paths
- Binary Tree Right side view
- Binary Tree Subtree check (Subtree of another tree)
- Binary Tree Zigzag Traversal
- Bitwise AND of Numbers range
- Bulb Switcher
- Bulls and Cows
- Climbing Stairs
- Clone Graph
- Coin Change *
- Coin Change II *
- Combination Sum
- Combination Sum II
- Combination Sum III
- Combinations
- Compare Version Numbers
- Construct Binary Tree from Inorder and Preorder Traversal
- Construct Binary Tree from Preorder and Inorder Traversal
- Container With Most Water
- Contains Duplicate
- Contains Duplicate II
- Contains Duplicate III *
- Convert Sorted Array To Binary Search Tree *
- Convert Sorted List To Binary Search Tree *
- Count and Say
- Count complete tree nodes *
- Count Primes
- Course Schedule *
- Course Schedule II *
- Different ways to add parenthesis
- Edit Distance **
- Divide Two Integers
- Evaluate Reverse Polish Notation
- Excel Sheet Column Number and Title
- Find item in Rotated Sorted Array
- Find item in Rotated Sorted Array II
- Find Minimum in Rotated Sorted Array *
- Find Minimum in Rotated Sorted Array II **
- Find Peak Element *
- First Missing Positive
- First Bad Version
- Flatten Binary Tree to Linked List *
- Fraction to Recurring Decimal *
- Gas Station *
- Gray Code *
- Group Anagrams *
- H-Index *
- H-Index II *
- Happy Number
- House Robber
- House Robber II
- House Robber III
- Generate Parenthesis
- Implement Queue using Stack
- Implement Stack using Queue
- Implement Queue using Stack
- Implement Trie (Prefix Tree) *
- Insertion sort List *
- Integer to English words *
- Integer to Roman
- Intersection of Two Linked Lists
- Invert Binary Tree
- Isomorphic Strings
- Jump Game *
- Jump Game II **
- Letter combination of a Phone Number
- Linked List Delete Node
- Longest Common Prefix
- Longest Palindromic Substring
- Median of Two Sorted Arrays
- Merge Two Sorted Lists
- Palindrome Number
- Pow(x,n)
- Remove Duplicates from Sorted Array
- Remove Element
- Reverse Integer
- Roman to Integer
- Search for a Range
- Search Insert Position
- Valid Parentheses
- ZigZag Conversion