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!!


  1. Run-length encoding (find/print frequency of letters in a string)
  2. Checking Anagrams (check whether two string is anagrams or not)
  3. Count and Say sequence
  4. Longest Common Prefix
  5. Count Substrings
  6. Number following the pattern
  7. Next Permutation
  8. Convert Ternary Expression to Binary Tree
  9. Count of strings that can be formed using a, b and c under given constraints
  10. Minimum Number of Flips
  11. Count Occurrences of Anagrams
  12. Rearrange a string
  13. Print bracket number
  14. Longest Palindromic Subsequence
  15. Preorder to Postorder of BST
  16. Maximum difference of zeros and ones in binary string
  17. Sum of all substrings of a number


  1. Sort an array of 0's, 1's and 2's in linear time complexity
  2. Check for Valid Sudoku
  3. Palindromic Array
  4. Largest Fibonacci Subsequence
  5. Pairs of songs with total durations divisible by 60
  6. All subarray Sum of an array
  7. Suggesting movie randomly from a list C++ program


  1. Sort an array of 0's, 1's and 2's in linear time complexity
  2. Relative sorting algorithm


  1. Finding First Bad Version
  2. Maximum value in a bitonic array
  3. Search for a Range

Coding Algorithms

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


  1. Find the level in a binary tree with given sum K
  2. Check whether a Binary Tree is BST (Binary Search Tree) or not
  3. Print vertical sum of a binary tree
  4. Print Boundary Sum of a Binary Tree
  5. Root to leaf Path Sum
  6. Print All Nodes that don't have Sibling
  7. Two Mirror Trees
  8. Transform to Sum Tree
  9. Symmetric Tree
  10. Convert Sorted Array to Binary Search Tree
  11. Odd even level difference in a binary tree
  12. Check if Tree is Isomorphic
  13. Expression Tree
  14. K distance from root
  15. Right View of Binary Tree
  16. Diameter of Binary Tree
  17. Delete nodes greater than or equal to k in a BST
  18. Reverse Level Order Traversal
  19. Diagonal Traversal of Binary Tree
  20. Leftmost and Rightmost Nodes of Binary Tree
  21. Lowest Common Ancestor in a BST
  22. Convert Ternary Expression to Binary Tree
  23. Bottom View of Binary Tree
  24. Ancestors in Binary Tree
  25. All Root to Leaf Paths
  26. Sum of all numbers formed by root to leaf path
  27. Minimum distance between two given nodes of a Binary Tree
  28. K-th smallest element in a Binary Search Tree
  29. Level order traversal in spiral form
  30. Maximum path sum in a binary tree
  31. Preorder to Postorder of BST
  32. Check Mirror in N-ary Tree


  1. Number following the pattern
  2. Print bracket number
  3. Stock Span Problem
  4. Redundant Bracket
  5. Postfix Expression Evaluation
  6. Largest rectangle area in a histogram
  7. Minimum Add to Make Parentheses Valid
  8. Check Mirror in N-ary Tree


  1. Check Mirror in N-ary Tree

Linked list

  1. Reverse a single linked list
  2. Find length of loop in a linked list
  3. Palindrome Linked List
  4. Intersection Point in Y-Shaped Linked List
  5. Absolute sorting on a single linked list
  6. Sum of two numbers represented by linked lists


  1. Rotten Oranges
  2. Alien Dictionary
  3. Find the number of islands
  4. Check a graph is Hamiltonian or not (Hamiltonian path)
  5. Knight walk problem
  6. Floyd Warshall Algorithm
  7. Minimum Spanning Tree

Binary search

  1. Book Allocation Problem (Allocate minimum number of pages)

Greedy Algorithms

  1. Greedy Strategy to solve major algorithm problems
  2. Job sequencing problem
  3. Fractional knapsack problem
  4. Rain Water Trapping Problem

Dynamic Programming

  1. 0-1 Knapsack Algorithm
  2. House Robber
  3. Coin Change
  4. Minimum Coin Change | Find minimum number of coins that make a given value
  5. Word Break Problem
  6. Friends pairing problem
  7. Maximum Profit in Stock Buy and sell with at most K Transaction
  8. Floyd Warshall Algorithm
  9. Optimal Strategy for a Game
  10. Highway billboard
  11. Gold Mine Problem
  12. Longest Increasing Subsequence
  13. Minimum Number of coins to make the change
  14. Get Minimum Squares
  15. Count Numbers with unique digits
  16. Maximum Sum Problem
  17. Find number of times a string occurs as a subsequence
  18. Number of Unique Paths
  19. Minimum number of jumps
  20. Rod Cutting

More Dynamic Programming Practice Problems


  1. Exit Point in a Matrix
  2. Shortest Source to Destination Path
  3. Gold Mine Problem


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

More Recursion Practice Problems...

Number theory

  1. Sieve of Eratosthenes

Bitwise operators

  1. Game of XOR


  1. Prisoners and the poison


  1. Total number of non-decreasing numbers with n digits


  1. String Matrix
  2. Tug of War
  3. Backtracking to find all subsets
  4. Find out the sum-string
  5. Power Set in Lexicographic order
  6. Fill 8 numbers in a matrix
  7. Partition a set into k subset with equal sum
  8. Combinational sum problem
  9. Combinational sum problem with repetition of digits
  10. Match a pattern and String without using regular expressions
  11. Warnsdorff's algorithm for Knight's tour problem

Iterative approach

  1. Find the largest palindromic substring using O(1) space complexity

Trie Data Structure

  1. Check the consistency of the numbers (Trie Data Structure Question)


  1. Length of the largest subarray with equal number of 0s and 1s
  2. Fencing Problem


  1. Constructing the Array

Brute Force

  1. Stock Span Problem
  2. Rain Water Trapping Problem
  3. Largest rectangle area in a histogram


  1. Redundant Bracket
  2. Rain Water Trapping Problem
  3. Longest Prefix and Suffix
  4. Fencing Problem
  5. Constructing the Array

Google contests

  1. Nesting Depth - Google CodeJam 2020 qualification round problem solution
  2. Vestigium - Google CodeJam 2020 qualification round problem1 solution


  1. Find nth Magic number
  2. Toppers of Class
  3. Where is my seat?
  4. Google CodeJam 2019 | Foregone Solution
  5. Find the perfect land of C shape
  6. Find the magic matrix


  1. Top 25 Dynamic programming problems for interviews
  2. Company Wise Interview Questions

Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.