# Interview coding problems/challenges

Hey geeks! Up for solving the **problems which are being asked in interviews?**

Here you go...

We are trying to list out the **most frequently asked interview problems** or the **problem given in the coding rounds of IT giants**.

For you we have detailed analysis:

- A proper explanation of question with explanations so that you can have a nice idea of your own and can think about a solution yourself.
- A detailed explanation of the solution with a generalized algorithm so that you can code yourself without checking our codes given at the end.
- If still, you have issues to figure out a solution then step by step explanation of the code. A detailed explanation of how the code works with the example?
- Don't think you will need anything more!!

Benefits if you hit our **Interview coding problems** pages: Definitely, we may have better ad sense earning more you hit the pages. But it’s not actually for us. The more you hit, the more you practice, the more you get prepared. You have to do some serious coding if you need to get hired. All over the net, you are surely in a loop considering where to start from. Here are we to light you up and that’s why we chose and place the best problems here. Some may seem to be easy, some may seem to be tough. No, issue if it’s easy just check whether you have a more optimized solution or not. If you have a more optimized solution, then feel free to post in the comments. Remember sharing is caring!!

**String**

- Run-length encoding (find/print frequency of letters in a string)
- Checking Anagrams (check whether two string is anagrams or not)
- Count and Say sequence
- Longest Common Prefix
- Count Substrings
- Number following the pattern
- Next Permutation
- Convert Ternary Expression to Binary Tree
- Count of strings that can be formed using a, b and c under given constraints
- Minimum Number of Flips
- Count Occurrences of Anagrams
- Rearrange a string
- Print bracket number
- Longest Palindromic Subsequence
- Preorder to Postorder of BST
- Maximum difference of zeros and ones in binary string
- Sum of all substrings of a number
- NAJPF - Pattern Find

**Arrays**

- Sort an array of 0's, 1's and 2's in linear time complexity
- Check for Valid Sudoku
- Palindromic Array
- Largest Fibonacci Subsequence
- Pairs of songs with total durations divisible by 60
- All subarray Sum of an array
- Suggesting movie randomly from a list C++ program
- Bus Routes Google Code Jam Round B Problem No. 2 Solution
- Bike Tour Google Kick Start Round B Problem 1 Solution

**Sorting**

- Sort an array of 0's, 1's and 2's in linear time complexity
- Relative sorting algorithm
- Weighted Job Scheduling
- Merge K Sorted Arrays
- Sort K-Sorted Array
- N Max Pair Combinations

**Searching**

- Finding First Bad Version
- Maximum value in a bitonic array
- Search for a Range
- Floor and Ceil Value
- First and last occurrence of an element
- Find Minimum in Rotated Sorted Array

**Coding Algorithms**

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Finding subarray with given sum
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Exit Point in a Matrix
- Generate Gray Code Sequences
- Picking Numbers

**Tree**

- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Root to leaf Path Sum
- Print All Nodes that don't have Sibling
- Two Mirror Trees
- Transform to Sum Tree
- Symmetric Tree
- Convert Sorted Array to Binary Search Tree
- Odd even level difference in a binary tree
- Check if Tree is Isomorphic
- Expression Tree
- K distance from root
- Right View of Binary Tree
- Diameter of Binary Tree
- Delete nodes greater than or equal to k in a BST
- Reverse Level Order Traversal
- Diagonal Traversal of Binary Tree
- Leftmost and Rightmost Nodes of Binary Tree
- Lowest Common Ancestor in a BST
- Convert Ternary Expression to Binary Tree
- Bottom View of Binary Tree
- Ancestors in Binary Tree
- All Root to Leaf Paths
- Sum of all numbers formed by root to leaf path
- Minimum distance between two given nodes of a Binary Tree
- K-th smallest element in a Binary Search Tree
- Level order traversal in spiral form
- Maximum path sum in a binary tree
- Preorder to Postorder of BST
- Check Mirror in N-ary Tree
- Count Number of Nodes in a Complete Binary Tree (Leetcode Problem Solution)

**Stack**

- Number following the pattern
- Print bracket number
- Stock Span Problem
- Redundant Bracket
- Postfix Expression Evaluation
- Largest rectangle area in a histogram
- Minimum Add to Make Parentheses Valid
- Check Mirror in N-ary Tree

**Queue**

**Linked list**

- Reverse a single linked list
- Find length of loop in a linked list
- Palindrome Linked List
- Intersection Point in Y-Shaped Linked List
- Absolute sorting on a single linked list
- Sum of two numbers represented by linked lists

**Graph**

- Rotten Oranges
- Alien Dictionary
- Find the number of islands
- Check a graph is Hamiltonian or not (Hamiltonian path)
- Knight walk problem
- Floyd Warshall Algorithm
- Minimum Spanning Tree
- PPATH - Prime Path Problem

**Binary search**

**Greedy Algorithms**

- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Fractional knapsack problem
- Rain Water Trapping Problem
- Parenting Partnering Returns - Google CodeJam 2020 Qualification Round Problem Solution

**Dynamic Programming**

- 0-1 Knapsack Algorithm
- House Robber
- Coin Change
- Minimum Coin Change | Find minimum number of coins that make a given value
- Word Break Problem
- Friends pairing problem
- Maximum Profit in Stock Buy and sell with at most K Transaction
- Floyd Warshall Algorithm
- Optimal Strategy for a Game
- Highway billboard
- Gold Mine Problem
- Longest Increasing Subsequence
- Minimum Number of coins to make the change
- Get Minimum Squares
- Count Numbers with unique digits
- Maximum Sum Problem
- Find number of times a string occurs as a subsequence
- Number of Unique Paths
- Minimum number of jumps
- Rod Cutting

More Dynamic Programming Practice Problems

**Matrix**

- Exit Point in a Matrix
- Shortest Source to Destination Path
- Gold Mine Problem
- Print all possible path from source to destination
- Matrix Probability
- Matrix Exponentiation
- Path in Matrix
- Set Matrix Zeroes
- Largest Square Sub Matrix of 1's in Given Binary Matrix

**Recursion**

- Palindromic Array
- Wine selling problem | Find the maximum profit from sale of wines
- Minimum Coin Change | Find minimum number of coins that make a given value
- Egg Dropping Problem
- Maximum path sum in a binary tree
- Minimum number of deletions to make a sorted sequence
- Jumbled Strings
- Count of divisible array
- Maximum Calorie
- Special Keyboard
- Minimal moves to form a string
- Total number of non-decreasing numbers with n digits using dynamic programming
- Minimum Time to Display N Character
- Knapsack with Duplicate Items
- Longest Common Subsequence of three strings
- Minimum steps to minimize n as per given condition
- Count total number of Palindromic Subsequences
- Adjacent are not allowed
- Count number of binary strings without consecutive 1's
- Longest Palindromic Substring
- Count total number of Palindromic Substrings

More Recursion Practice Problems...

**Number Theory**

- Sieve of Eratosthenes
- Matrix Exponentiation
- GCD Queries - Greatest Common Divisor Problem
- PPATH - Prime Path Problem

**Bitwise operators**

**Puzzle**

**Combinatorics**

**Backtracking**

- String Matrix
- Tug of War
- Backtracking to find all subsets
- Find out the sum-string
- Power Set in Lexicographic order
- Fill 8 numbers in a matrix
- Partition a set into k subset with equal sum
- Combinational sum problem
- Combinational sum problem with repetition of digits
- Match a pattern and String without using regular expressions
- Warnsdorff's algorithm for Knight's tour problem
- Partition to K Equal Sum Subsets
- Print all possible path from source to destination
- N-Queen Problem
- Print all subsequences of a string
- Count Unique Path

**Iterative approach**

**Trie Data Structure**

**Hash**

**Heap**

**Brute Force**

- Stock Span Problem
- Rain Water Trapping Problem
- Largest rectangle area in a histogram
- Floor and Ceil Value
- First and last occurrence of an element
- Maximization of Quadruple
- Find Minimum in Rotated Sorted Array
- GCD Queries - Greatest Common Divisor Problem
- PPATH - Prime Path Problem
- N Max Pair Combinations

**DFS**

**Segment Tree**

**Lazy Propagation**

**Implementation**

- Redundant Bracket
- Rain Water Trapping Problem
- Longest Prefix and Suffix
- Fencing Problem
- Constructing the Array
- Merge K Sorted Arrays
- Set Matrix Zeroes
- GCD Queries - Greatest Common Divisor Problem

**Google contests**

- Nesting Depth - Google CodeJam 2020 qualification round problem solution
- Vestigium - Google CodeJam 2020 qualification round problem1 solution
- Bus Routes Google Code Jam Round B Problem No. 2 Solution
- Bike Tour Google Kick Start Round B Problem 1 Solution
- Parenting Partnering Returns - Google CodeJam 2020 Qualification Round Problem Solution

**Competitive programming**

- How to overcome TLE in competitive programming?
- Check the consistency of the numbers (Trie Data Structure Question)
- Constructing the Array
- Range Minimum Query
- PPATH - Prime Path Problem

**Miscellaneous**

- Find nth Magic number
- Toppers of Class
- Where is my seat?
- Google CodeJam 2019 | Foregone Solution
- Find the perfect land of C shape
- Find the magic matrix

**Others**

What's New

- Business Environment MCQs
- Sustainable Development MCQs
- Marginal Costing and Absorption Costing MCQs
- Globalisation MCQs
- Indian Economy MCQs
- Retained Earnings MCQs
- Depreciation MCQs
- Partnership MCQs
- Sole Proprietorship MCQs
- Goods and Services Tax (GST) MCQs
- Cooperative Society MCQs
- Capital Market MCQs
- Business Studies MCQs
- Basic Accounting MCQs
- MIS Executive Interview Questions
- Go Language Interview Questions

Top Interview Coding Problems/Challenges!

- Run-length encoding (find/print frequency of letters in a string)
- Sort an array of 0's, 1's and 2's in linear time complexity
- Checking Anagrams (check whether two string is anagrams or not)
- Relative sorting algorithm
- Finding subarray with given sum
- Find the level in a binary tree with given sum K
- Check whether a Binary Tree is BST (Binary Search Tree) or not
- 1[0]1 Pattern Count
- Capitalize first and last letter of each word in a line
- Print vertical sum of a binary tree
- Print Boundary Sum of a Binary Tree
- Reverse a single linked list
- Greedy Strategy to solve major algorithm problems
- Job sequencing problem
- Root to leaf Path Sum
- Exit Point in a Matrix
- Find length of loop in a linked list
- Toppers of Class
- Print All Nodes that don't have Sibling
- Transform to Sum Tree
- Shortest Source to Destination Path

Comments and Discussions!