Skip to content

spaceman-dev/GFG-Must-Do-Coding-Questions

Repository files navigation

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

Difficulty Level : Medium

LINK

Arrays :

  1. Subarray with given sum
  2. Count the triplets
  3. Kadane’s Algorithm
  4. Missing number in array
  5. Merge two sorted arrays
  6. Rearrange array alternatively
  7. Number of pairs
  8. Inversion of Array
  9. Sort an array of 0s, 1s and 2s
  10. Equilibrium point
  11. Leaders in an array
  12. Minimum Platforms
  13. Reverse array in groups
  14. K’th smallest element
  15. Trapping Rain Water
  16. Pythagorean Triplet
  17. Chocolate Distribution Problem
  18. Stock buy and sell
  19. Element with left side smaller and right side greater
  20. Convert array into Zig-Zag fashion
  21. Last Index of 1
  22. Spirally traversing a matrix
  23. Largest Number formed from an Array

String :

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

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. Intersection point in Y shaped linked lists
  6. Detect Loop in linked list
  7. Remove loop in Linked List
  8. n’th node from end of linked list
  9. Flattening a Linked List
  10. Merge two sorted linked lists
  11. Intersection point of two Linked Lists
  12. Pairwise swap of a linked list
  13. Add two numbers represented by linked lists
  14. Check if Linked List is Palindrome
  15. Implement Queue using Linked List
  16. Implement Stack using Linked List
  17. Given a linked list of 0s, 1s and 2s, sort it
  18. Delete without head pointer

Stack and Queue :

  1. Parenthesis Checker
  2. Next larger element
  3. Queue using two Stacks
  4. Stack using two queues
  5. Get minimum element from stack
  6. LRU Cache
  7. Circular tour
  8. First non-repeating character in a stream
  9. Rotten Oranges
  10. Maximum of all subarrays of size k

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

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
  7. Kth largest element in a stream

Recursion :

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

Hashing :

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

Graph :

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

Greedy :

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

Dynamic Programming :

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

Divide and Conquer :

  1. Find the element that appears once in sorted array
  2. Search in a Rotated Array
  3. Binary Search
  4. Sum of Middle Elements of two sorted arrays
  5. Quick Sort
  6. Merge Sort
  7. K-th element of two sorted Arrays

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. Find Missing And Repeating
  2. Maximum Index
  3. Consecutive 1’s not allowed
  4. Majority Element
  5. Two numbers with sum closest to zero
  6. Nuts and Bolts Problem
  7. Boolean Matrix Problem
  8. Smallest Positive missing number
  9. Jumping Caterpillars

Some More Questions on Strings :

  1. Most frequent word in an array of strings
  2. CamelCase Pattern Matching
  3. String Ignorance
  4. Smallest window in a string containing all the characters of another string
  5. Design a tiny URL or URL shortener
  6. Permutations of a given string
  7. Non Repeating Character
  8. Check if strings are rotations of each other or not
  9. Save Ironman
  10. Repeated Character
  11. Remove common characters and concatenate
  12. Geek and its Colored Strings
  13. 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
  5. Binary to DLL