Technical Interview Preparation
This repository contains my interview preparation journey for technical interviews.
It includes my solutions to various topics including -
- Problem Solving
- Language specific problems
- Design Patterns
- Frameworks
Problem Solving
450 DSA
Collection of 450 problems on Data Structures and Algorithms
Arrays
- Reverse the array (Java, Python, JavaScript)
- Find the maximum and minimum element in an array (Java, Python, JavaScript)
- Find the "Kth" max and min element of an array (Java, Python, JavaScript)
- Given an array which consists of only 0, 1 and 2. Sort the array without using any sorting algorithm (Java, Python, JavaScript)
- Move all the negative elements to one side of the array (Java, Python, JavaScript)
- Find the Union and Intersection of the two sorted arrays. (Java, Python, JavaScript)
- Write a program to cyclically rotate an array by one. (Java, Python, JavaScript)
- Find Largest sum contiguous Subarray (Java, Python, JavaScript)
- Minimize The Maximum Difference Between Heights (Java, Python, JavaScript)
- Minimum Number Of Jumps To Reach End Of An Array (Java, Python, JavaScript)
- Find Duplicate In An Array Of (N + 1) Integers (Java, Python, JavaScript)
- Merge Two Sorted Arrays Without Using Extra Space (Java, Python, JavaScript)
- Kadane Algorithm (Java, Python, JavaScript)
- Merge Intervals (Java, Python, JavaScript)
- Next Permutation (Java, Python, JavaScript)
- Count Inversions (Java, Python, JavaScript)
- Best Time To Buy And Sell Stocks (Java, Python, JavaScript)
- Count Pairs With Given Sum (Java, Python, JavaScript)
- Common Element In Three sorted Arrays (Java, Python, JavaScript)
- Rearrange The Array In Alternating Positive And Negative Items With O(1) Extra Space (Java, Python, JavaScript)
- Find If There Is Any Subarray With Sum Equal To 0 (Java, Python, JavaScript)
- Find Factorial Of A Large Number (Java, Python, JavaScript)
- Find Maximum Product Subarray (Java, Python, JavaScript)
- Find Longest Consecutive Subsequence (Java, Python, JavaScript)
- Given An Array of Size n And A number k, Find All Elements That Appear More Than n/k Times (Java, Python, JavaScript)
- Maximum Profit By Buying And Selling A Share At Most Twice (Java, Python, JavaScript)
- Find Whether An Array Is A Subset Of Another Array (Java, Python, JavaScript)
- Find The Triplet That Sum To A Given Value (Java, Python, JavaScript)
- Trapping Rain Water (Java, Python, JavaScript)
- Chocolate Distribution Problem (Java, Python, JavaScript)
- Smallest Subarray With Sum Greater Than A Given Value (Java, Python, JavaScript)
- Three Way Partitioning Of An Array Around A Given Value (Java, Python, JavaScript)
- Minimum Swaps Required Bring Elements Less Than Or Equal To K Together (Java, Python, JavaScript)
- Minimum No. Of Operations Required To Make An Array Palindrome (Java, Python, JavaScript)
- Median Of 2 Sorted Arrays Of Equal Size (Java, Python, JavaScript)
- Median Of 2 Sorted Arrays Of Unequal Size (Java, Python, JavaScript)
Matrix
- Spiral Traversal Of A Matrix (Java, Python, JavaScript)
- Search An Element In A Matrix (Java, Python, JavaScript)
- Find Median In A Row Wise Sorted Matrix (Java, Python, JavaScript)
- Find Row With Maximum No. Of 1s (Java, Python, JavaScript)
- Sort a Matrix (Java, Python, JavaScript)
- Maximum Size Rectangle (Java, Python, JavaScript)
- Find A Specific Pair In Matrix (Java, Python, JavaScript)
- Rotate Matrix By 90 Degrees (Java, Python, JavaScript)
- Kth Smallest Element In A Row-Column Wise Sorted Matrix (Java, Python, JavaScript)
- Common Elements In All Rows Of A Given Matrix (Java, Python, JavaScript)
String
- Reverse String (Java, Python, JavaScript)
- Check Palindrome (Java, Python, JavaScript)
- Find Duplicate Characters In A String (Java, Python, JavaScript)
- Check Whether One String Is A Rotation Of Another (Java, Python, JavaScript)
- Check Whether A String Is A Valid Shuffle Of Two Strings (Java, Python, JavaScript)
- Count And Say Problem (Java, Python, JavaScript)
- Longest Palindromic Substring (Java, Python, JavaScript)
- Longest Repeating Subsequence (Java, Python, JavaScript)
- Find All Subsequences Of A String (Java, Python, JavaScript)
- Find All Permutations Of A String (Java, Python, JavaScript)
- Split The Binary String Into Substrings With Equal 0s And 1s (Java, Python, JavaScript)
- Word Wrap Problem (Java, Python, JavaScript)
- Edit Distance (Java, Python, JavaScript)
- Next Permutation (Java, Python, JavaScript)
- Balanced Parentheses (Java, Python, JavaScript)
- Word Break (Java, Python, JavaScript)
- Rabin Karp Algorithm (Java, Python, JavaScript)
- KMP Algorithm (Java, Python, JavaScript)
- Convert A Sentence Into Its Equivalent Mobile Numeric Keypad Sequence (Java, Python, JavaScript)
- Minimum Number Of Bracket Reversals Needed To Make An Expression Balanced (Java, Python, JavaScript)
- Count All Palindromic Subsequence In A Given String (Java, Python, JavaScript)
- Check If Given String Exists In 2D Character Array (Java, Python, JavaScript)
- Search A Word In A 2D Grid Of Characters (Java, Python, JavaScript)
- Boyer Moore Algorithm (Java, Python, JavaScript)
- Roman To Integer (Java, Python, JavaScript)
- Longest Common Prefix (Java, Python, JavaScript)
- Number Of Flips To Make Binary String Alternate (Java, Python, JavaScript)
- Second Most Repeated String In A Sequence (Java, Python, JavaScript)
- Minimum Swaps For Bracket Balancing (Java, Python, JavaScript)
- Longest Common Subsequence (Java, Python, JavaScript)
- Program To Generate All Possible Valid IP Addresses From Given String (Java, Python, JavaScript)
- Find The Smallest Window That Contains All Characters Of String Itself (Java, Python, JavaScript)
- Rearrange Characters In A String Such That No Two Adjacent Are Same (Java, Python, JavaScript)
- Minimum Characters To Be Added At Front To Make String Palindrome (Java, Python, JavaScript)
- Group Anagrams (Java, Python, JavaScript)
- Find The Smallest Window In A String Containing All Characters Of Another String (Java, Python, JavaScript)
- Remove Consecutive Duplicate Characters (Java, Python, JavaScript)
- String Matching Where One String Contains Wildcard Characters (Java, Python, JavaScript)
- Find Number Of Customers Who Could Not Get A Computer (Java, Python, JavaScript)
- Transform One String To Another Using Minimum Number Of Given Operation (Java, Python, JavaScript)
- Check If Two Given Strings Are Isomorphic To Each Other (Java, Python, JavaScript)
- Recursively Print All Sentences That Can Be Formed From List Of Word Lists (Java, Python, JavaScript)
Lists
- Reverse The Linked List (Java, Python, JavaScript)
- Reverse A Linked List In Group Of Given Size (Java, Python, JavaScript)
Binary Trees
- Level Order Traversal (Java, Python, JavaScript)
- Reverse Level Order Traversal (Java, Python, JavaScript)
- Height Of A Binary Tree (Java, Python, JavaScript)
- Diameter Of A Binary Tree (Java, Python, JavaScript)
- Mirror Of A Tree (Java, Python, JavaScript)
- Inorder Traversal (Java, Python, JavaScript)
- Preorder Traversal (Java, Python, JavaScript)
- Postorder Traversal (Java, Python, JavaScript)
- Left View Of A Tree (Java, Python, JavaScript)
- Right View Of A Tree (Java, Python, JavaScript)
- Top View Of A Tree (Java, Python, JavaScript)
- Bottom View Of A Tree (Java, Python, JavaScript)
Dynamic Programming
- Coin Change (Java, Python, JavaScript)
- Knapsack Problem (Java, Python, JavaScript)
- Binomial Coefficient (Java, Python, JavaScript)
- Permutation Coefficient (Java, Python, JavaScript)
- Nth Catalan Number (Java, Python, JavaScript)
- Matrix Chain Multiplication (Java, Python, JavaScript)
- Edit Distance (Java, Python, JavaScript)
- Partition Equal Subset Sum (Java, Python, JavaScript)
- Friends Pairing Problem (Java, Python, JavaScript)
- Gold Mine Problem (Java, Python, JavaScript)
- Assembly Line Scheduling (Java, Python, JavaScript)
- Painting The Fence (Java, Python, JavaScript)
- Maximize The Cut Segments (Java, Python, JavaScript)
- Longest Common Subsequence (Java, Python, JavaScript)
- Longest Repeating Subsequence (Java, Python, JavaScript)
- Longest Increasing Subsequence (Java, Python, JavaScript)
- Space Optimized Longest Common Subsequence (Java, Python, JavaScript)
- Longest Common Subsequence Of Three Strings (Java, Python, JavaScript)
- Maximum Sum Increasing Subsequence (Java, Python, JavaScript)
- Subsequences Product Less Than K (Java, Python, JavaScript)
- Longest Arithmetic Subsequence of Given Difference (Java, Python, JavaScript)
- Maximum Subsequence Sum Without Three Consecutive (Java, Python, JavaScript)
- Egg Drop (Java, Python, JavaScript)
- Maximum Length of Pair Chain (Java, Python, JavaScript)
- Maximal Square (Java, Python, JavaScript)
- Pairs With Specific Difference (Java, Python, JavaScript)
- Maximum Path Sum (Java, Python, JavaScript)
- Maximum Difference Of Zeros And Ones (Java, Python, JavaScript)
- Minimum Number Of Jumps (Java, Python, JavaScript)
- Minimum Cost To Fill Given Weight In A Bag (Java, Python, JavaScript)
- Minimum Removals From Array (Java, Python, JavaScript)
- Longest Common Substring (Java, Python, JavaScript)
- Reach A Given Score (Java, Python, JavaScript)
- Count Balanced Binary Trees Of Height h (Java, Python, JavaScript)
- Largest Sum Contiguous Subarray (Java, Python, JavaScript)
- Smallest Sum Contiguous Subarray (Java, Python, JavaScript)
- Unbounded Knapsack (Java, Python, JavaScript)
- Word Break (Java, Python, JavaScript)
- Largest Independent Set (Java, Python, JavaScript)
- Longest Palindromic Subsequence (Java, Python, JavaScript)
- Count All Palindromic Subsequences (Java, Python, JavaScript)
- Longest Palindromic Substring (Java, Python, JavaScript)
- Longest Alternating Subsequence (Java, Python, JavaScript)
- Weighted Job Scheduling (Java, Python, JavaScript)
- Coin Game Winner (Java, Python, JavaScript)
- Count Derangements (Java, Python, JavaScript)
- Buy And Sell Stocks Atmost Twice (Java, Python, JavaScript)
- Optimal Game Strategy (Java, Python, JavaScript)
- Optimal Binary Search Tree (Java, Python, JavaScript)
- Palindrome Partitioning (Java, Python, JavaScript)
- Word Wrap (Java, Python, JavaScript)
- Mobile Numeric Keypad (Java, Python, JavaScript)
- Boolean Parenthesization (Java, Python, JavaScript)
- Largest Rectangular Submatrix With Zero Sum (Java, Python, JavaScript)
- Largest Submatrix With Equal 1s And 0s (Java, Python, JavaScript)
- Maximum Sum Rectangle (Java, Python, JavaScript)
- Buying And Selling Stock At Most K Times (Java, Python, JavaScript)
- Interleaving Strings (Java, Python, JavaScript)
Bit Manipulation
- Count Set Bits (Java, Python, JavaScript)
- Non Repeating Numbers (Java, Python, JavaScript)
- Count Number Of Bits To Be Flipped To Convert A To B (Java, Python, JavaScript)
- Count Total Set Bits In All Numbers From 1 To N (Java, Python, JavaScript)
- Power Of Two (Java, Python, JavaScript)
- Find Position Of Set Bit (Java, Python, JavaScript)
- Copy Set Bits In A Range (Java, Python, JavaScript)
- Divide Two Integers (Java, Python, JavaScript)
- Calculate Square Of A Number (Java, Python, JavaScript)
- Power Set (Java, Python, JavaScript)
Cracking The Coding Interview
Arrays and Strings
- Is Unique
- Check Permutation
- URLify
- Palindrome Permutation
- One Away
- String Compression
- Rotate Matrix
- Zero Matrix
- String Rotation
Linked Lists
- Remove Duplicates
- Return Kth To Last
- Delete Middle Node
- Partition
- Sum Lists
- Palindrome
- Intersection
- Loop Detection
Stacks and Queues
Trees and Graphs
- Route Between Nodes
- Minimal Tree
- List of Depths
- Check Balanced
- Validate BST
- Successor
- Build Order
- First Common Ancestor
- BST Sequences
- Check Subtree
- Random Node
- PathsWithSum