Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, …

As the placement season is back so are we to help you ace the interview. We have selected some most commonly asked and must do practice problems for you.

You can also take part in our mock placement contests which will help you learn different topics and practice at the same time, simulating the feeling of a real placement test environment.

Topic :

Arrays :

  1. Subarray with given sum
  2. Kadane’s Algorithm
  3. Missing number in array
  4. Subarray with given sum
  5. Sort an array of 0s, 1s and 2s
  6. Equilibrium point
  7. Maximum sum increasing subsequence
  8. Leaders in an array
  9. Minimum Platforms
  10. Maximum of all subarrays of size k
  11. Reverse array in groups
  12. K’th smallest element
  13. Trapping Rain Water
  14. Pythagorean Triplet
  15. Chocolate Distribution Problem
  16. Stock buy and sell
  17. Element with left side smaller and right side greater
  18. Convert array into Zig-Zag fashion
  19. Find the element that appears once in sorted array
  20. Kth largest element in a stream
  21. Relative Sorting
  22. Spirally traversing a matrix
  23. Sorting Elements of an Array by Frequency
  24. Largest Number formed from an Array
  25. Largest subarray of 0’s and 1’s

Solved the above? Go for some more Questions

String :

  1. Parenthesis Checker
  2. Reverse words in a given string
  3. Permutations of a given string
  4. Longest Palindrome in a String
  5. Recursively remove all adjacent duplicates
  6. Check if string is rotated by two places
  7. Roman Number to Integer
  8. Anagram
  9. Longest Common Substring
  10. Remove Duplicates
  11. Form a Palindrome
  12. Longest Distinct Characters in the string
  13. Implement Atoi
  14. Implement strstr
  15. Longest Common Prefix

Solved the above? Go for some more Questions

Linked List :

  1. Finding middle element in a linked list
  2. Reverse a linked list
  3. Rotate a Linked List
  4. Reverse a Linked List in groups of given size
  5. Detect Loop in linked list
  6. Remove loop in Linked List
  7. n’th node from end of linked list
  8. Flattening a Linked List
  9. Merge two sorted linked lists
  10. Intersection point of two Linked Lists
  11. Pairwise swap of a linked list
  12. Add two numbers represented by linked lists
  13. Check if Linked List is Palindrome
  14. Implement Queue using Linked List
  15. Implement Stack using Linked List
  16. Given a linked list of 0s, 1s and 2s, sort it
  17. Delete without head pointer

Stack and Queue :

  1. Next larger element
  2. Queue using two Stacks
  3. Stack using two queues
  4. Get minimum element from stack
  5. LRU Cache
  6. Circular tour
  7. First non-repeating character in a stream
  8. Rotten Oranges

Tree :

  1. Print Left View of Binary Tree
  2. Check for BST
  3. Print Bottom View of Binary Tree
  4. Print a Binary Tree in Vertical Order
  5. Level order traversal in spiral form
  6. Connect Nodes at Same Level
  7. Lowest Common Ancestor in a BST
  8. Convert a given Binary Tree to Doubly Linked List
  9. Write Code to Determine if Two Trees are Identical or Not
  10. Given a binary tree, check whether it is a mirror of itself
  11. Height of Binary Tree
  12. Maximum Path Sum
  13. Diameter of a Binary Tree
  14. Number of leaf nodes
  15. Check if given Binary Tree is Height Balanced or Not
  16. Serialize and Deserialize a Binary Tree

Solved the above? Go for some more Questions

Heap :

  1. Find median in a stream
  2. Heap Sort
  3. Operations on Binary Min Heap
  4. Rearrange characters
  5. Kth largest element in a stream
  6. Merge K sorted linked lists

Recursion :

  1. Flood fill Algorithm
  2. Number of paths
  3. Combination Sum – Part 2
  4. Special Keyboard
  5. Water Overflow
  6. Josephus problem

Hashing :

  1. Largest subarray with 0 sum
  2. Swapping pairs make sum equal
  3. Count distinct elements in every window
  4. Array Pair Sum Divisibility Problem
  5. Longest consecutive subsequence
  6. Array Subset of another array
  7. Find all pairs with a given sum
  8. Find first repeated character
  9. Zero Sum Subarrays
  10. Minimum indexed character
  11. Check if two arrays are equal or not
  12. Uncommon characters
  13. Smallest window in a string containing all the characters of another string
  14. First element to occur k times
  15. Check if frequencies can be equal

Graph :

  1. Depth First Traversal
  2. Breadth First Traversal
  3. Detect cycle in a directed graph
  4. Topological sort
  5. Find the number of islands
  6. Implementing Dijkstra
  7. Minimum Swaps
  8. Strongly Connected Components
  9. Shortest Source to Destination Path
  10. Find whether path exist
  11. Minimum Cost Path
  12. Circle of Strings
  13. Floyd Warshall
  14. Alien Dictionary
  15. Snake and Ladder Problem

Greedy :

  1. Activity Selection
  2. N meetings in one room
  3. Coin Piles
  4. Minimum number of Coins
  5. Maximize Toys
  6. Page Faults in LRU
  7. Largest number possible
  8. Minimize the heights
  9. Minimize the sum of product
  10. Huffman Decoding
  11. Max length chain
  12. Minimum Spanning Tree
  13. Minimum Operations
  14. Shop in Candy Store
  15. Geek collects the balls

Dynamic Programming :

  1. Longest Increasing Subsequence
  2. Longest Common Subsequence
  3. 0 – 1 Knapsack Problem
  4. Minimum number of jumps
  5. Edit Distance
  6. Coin Change Problem
  7. Subset Sum Problem
  8. Box Stacking
  9. Rod Cutting
  10. Path in Matrix
  11. Minimum sum partition
  12. Count number of ways to cover a distance
  13. Egg Dropping Puzzle
  14. Optimal Strategy for a Game
  15. Shortest Common Supersequence

Divide and Conquer :

  1. Binary Search
  2. Quick Sort
  3. Merge Sort
  4. Find the element that appears once in sorted array
  5. K-th element of two sorted Arrays
  6. Last index of One

Backtracking :

  1. N-Queen Problem
  2. Solve the Sudoku
  3. Rat in a Maze Problem
  4. Word Boggle
  5. Generate IP Addresses

Bit Magic :

  1. Find first set bit
  2. Rightmost different bit
  3. Check whether K-th bit is set or not
  4. Toggle bits given range
  5. Set kth bit
  6. Power of 2
  7. Bit Difference
  8. Rotate Bits
  9. Swap all odd and even bits
  10. Count total set bits
  11. Longest Consecutive 1’s
  12. Sparse Number
  13. Alone in a couple
  14. Maximum subset XOR

Some More Questions on Arrays :

  1. Most frequent word in an array of strings
  2. Most frequent word in an array of strings
  3. Find Missing And Repeating
  4. Maximum Index
  5. Search in a Rotated Array
  6. Sum of Middle Elements of two sorted arrays
  7. Consecutive 1’s not allowed
  8. Majority Element
  9. Two numbers with sum closest to zero
  10. Nuts and Bolts Problem
  11. Boolean Matrix Problem
  12. K’th smallest element
  13. Find all four sum numbers
  14. Common elements
  15. Smallest Positive missing number
  16. Count the triplets
  17. Maximum Index
  18. Jumping Caterpillars

Some More Questions on Strings :

  1. CamelCase Pattern Matching
  2. String Ignorance
  3. Smallest window in a string containing all the characters of another string
  4. Design a tiny URL or URL shortener
  5. Permutations of a given string
  6. Non Repeating Character
  7. Check if strings are rotations of each other or not
  8. Save Ironman
  9. Repeated Character
  10. Remove common characters and concatenate
  11. Geek and its Colored Strings
  12. Second most repeated string in a sequence

Some more Questions on Trees :

  1. Mirror Tree
  2. Longest consecutive sequence in Binary tree
  3. Bottom View of Binary Tree
  4. Lowest Common Ancestor in a Binary Tree

Important Links :

  1. Difficulty-wise ordered Coding questions for Interview and Competitive Programming
  2. Aptitude questions asked in round 1 : Placements Course designed for this purpose.
  3. MCQs asked from different computer science subjects : Subject-Wise Quizzes
  4. Interview theory and coding questions of all companies : Company wise all practice questions.
  5. Interview experiences of all companies : Interview corner.

Additional Resources

Online Interview Preparation Course (Free)

Register Here

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

My Personal Notes arrow_drop_up