Must Do Coding Questions Company-wise
Preparing for interview coding questions can be challenging, especially with the wide range of questions you might be asked. To help make your preparation more focused and effective, we've put together a list of essential coding questions asked by top tech companies. This guide covers questions from major tech giants like Google, Facebook, and Amazon, as well as other important companies in the tech industry. Each section focuses on the specific types of problems these companies typically ask during interviews. By diving into this guide, you can get ready to tackle your interviews with the right preparation and mindset. The goal is to provide you with the key questions to practice so you can approach your interviews feeling prepared and self-assured.
Top Tech Companies:
Google Interview Coding Questions:
Easy:
- Remove duplicate elements from sorted Array
- Smallest subarray with sum greater than x
- Left most and right most index
- Count BST nodes that lie in a given range
- Longest Common Prefix in an Array
- Check if two strings are k-anagrams or not
- Generate binary string
- Modular Exponentiation (Power in Modular Arithmetic)
Medium:
- Subarray with given sum
- Maximum Index
- Finding the numbers
- Jumping Numbers
- Connect Nodes at Same Level
- Interleaved Strings
- Find triplets with zero sum
- Egg Dropping Puzzle
- Word Break Problem
- Check if a Binary Tree contains duplicate subtrees of size 2 or more
- Find largest word in dictionary
Hard:
- Longest valid Parentheses
- Implement LRU Cache
- Find number of closed islands
- Sorted Link List to BST
- Maximum Rectangular Area in a Histogram
- Find median in a stream
- Merge two BST 's
Facebook Interview Coding Questions:
Easy:
- Find all pairs with a given sum
- Minimum Depth of a Binary Tree
- Implement strstr
- K-Palindrome
- Largest subset whose all elements are Fibonacci numbers
- Converting Decimal Number lying between 1 to 3999 to Roman Numerals
- Find all pairs with a given sum
- Minimum Depth of a Binary Tree
Medium:
- Subarray with given sum
- Total Decoding Messages
- Word Boggle
- Activity Selection
- Multiply two strings
- Find triplets with zero sum
- Look-and-Say Sequence
- Stock buy and sell II
- Rotate a 2D array without using extra space
- Count distinct pairs with difference k
- Multiply two strings
- Print leaf nodes from preorder traversal of BST
Hard:
Amazon Interview Coding Questions:
Easy:
- Implement a stack with push(), pop() and min() in O(1) time
- Level order traversal
- Check if a binary tree is BST or not
- Rotate Array
- Equal point in a string of brackets
- Addition of submatrix
- Count pairs with given sum
Medium:
- Add two numbers represented by linked lists
- Stock span problem
- Next larger element
- Maximum of all subarrays of size k
- Print a Binary Tree in Vertical Order
- Pythagorean Triplet
- Find the number of islands
- Detect and Remove Loop in a Linked List
- Arrange given numbers to form the biggest number
- Maximum difference between node and its ancestor in Binary Tree
Hard:
- Implement LRU Cache
- Reverse a Linked List in groups of given size
- Convert a Binary tree to DLL
- Edit distance
- Smallest window in a string containing all the characters of another string
- Boolean Parenthesization
- Closest Palindrome
- Smallest range in K lists
Microsoft Interview Coding Questions:
Easy:
- Key Pair
- Is Binary Number Multiple of 3
- Missing number in array
- Check for BST
- Finding middle element in a linked list
- Root to leaf path sum
- Reverse a linked list
- Remove every k’th node
- Write an Efficient Function to Convert a Binary Tree into its Mirror Tree
- Determine if Two Trees are Identical
Medium:
- Kadane’s Algorithm
- Majority Element
- Search in a Rotated Array
- Merge 2 sorted linked list in reverse order
- Longest Even Length Substring such that Sum of First and Second Half is same
- Three Sum Closest
- Coin Change
- Pascal Triangle
- Largest Number formed from an Array
- Kth Smallest
Hard:
- Max Circular Subarray Sum
- Strictly Increasing Array
- Median of 2 Sorted Arrays of Different Sizes
- Travelling Salesman Problem
- Alien Dictionary
Adobe Interview Coding Questions:
Easy:
- Reverse words in a given string
- Check for BST
- Root to leaf path sum
- Finding middle element in a linked list
- Reverse a linked list
- Level order traversal in spiral form
- Right View of Binary Tree
- Remove duplicate element from sorted Linked List
- Count set bits in an integer
Medium:
- Search in a Rotated Array
- Subset Sum Problem
- Sort an array of 0s, 1s and 2s
- Minimum number of jumps
- Sum Tree
- Merge Sort for Linked List
- Find triplets with zero sum
- Nuts and Bolts Problem
- Minimum X (xor) A
- Count Inversions
Hard:
- Merge Without Extra Space
- Number of distinct words with K maximum contiguous vowels
- Reverse a Linked List in Groups
- Clone a linked list with next and random pointer
- Burning Tree
Oracle Interview Coding Questions:
Easy:
- Search in a matrix
- Power of 2
- Root to leaf path sum
- Implement Queue using Linked List
- Connect Nodes at Same Level
- Implement Stack using Queues
- Implement Queue using Stacks
- Remove duplicate element from sorted Linked List
- Find the first repeating element in an array of integers
- Smallest subarray with sum greater than x
Medium:
- 0 – 1 Knapsack Problem
- Kadane’s Algorithm
- Remove loop in Linked List
- Sorting Elements of an Array by Frequency
- Spirally traversing a matrix
- Heap Sort
- Remove loop in Linked List
Hard:
D. E. Shaw Interview Coding Questions:
Easy:
- Two Mirror Trees
- Stack using two queues
- Reverse a Doubly Linked List
- Palindrome Substring
- Intersection Sorted Linked Lists
- Find the element that appears once in sorted array
- Print all nodes that don't have sibling
- Count BST nodes that lie in a given range
- Maximum no of 1's row
Medium:
- Stock buy and sell II
- Missing And Repeating
- Sum of Middle Elements of two sorted arrays
- Maximum Product Subarray
- Magnet Array Problem
- Spirally traversing a matrix
- Check if two Nodes are Cousins
- Search in a Rotated Array
- Largest BST
- Print Anagrams Together
- Rotate by 90 degree
- Water Overflow
Hard:
- Longest Increasing Path in a Matrix
- Find median in a stream
- Clone a linked list with next and random pointer
- Insert and Search in a Trie
- Topological sort
Directi Interview Coding Questions:
Easy:
Medium:
- Maximum of all subarrays of size k
- Word Boggle
- Jumping Numbers
- Transform String
- Array Pair Sum Divisibility Problem
- Maximum Intervals Overlap
- Maximize Dot Product
- Excel Sheet | Part – 1
- Probability of Knight
- K-Nearest Neighbours
- K Sized Subarray Maximum
- Stock buy and sell
Hard:
Accolite Interview Coding Questions:
Easy:
- Count Squares
- Sum of two numbers represented as arrays
- Max sum submatrix
- Root to leaf path sum
- Level order traversal in spiral form
- Implement Stack using Queues
- n’th node from end of linked list
- Product array puzzle
Medium:
- Coin Change
- Permutations of a given string
- Stock buy and sell
- Longest Palindrome in a String
- Maximum sum Rectangle
- Lowest Common Ancestor in a Binary Tree
- Maximize Number of 1's
- Kth Smallest
- Top k numbers in a stream
- Tic Tac Toe
Hard:
Morgan Stanley Interview Coding Questions:
Easy:
- Missing number in array
- Remove duplicate elements from sorted Array
- Minimum element in a sorted and rotated array
- Next greater number set digits
- Minimum Distinct Ids
- Largest subarray of 0's and 1's
- Palindrome Substring
- Delete Middle of a Linked List
- Kth from End of Linked List
Medium:
- Consecutive 1's not allowed
- Coin Change
- Find whether path exist
- Factorials of large numbers
- Swap Kth nodes from ends
- Circular tour
- Check if subtree
- Maximum sum leaf to root path
- Maximum Winning score
- Activity Selection
Hard:
- Number of subsets with product less than k
- Clone a linked list with next and random pointer
- Binary Tree to DLL
- Find median in a stream
- AVL Tree Insertion
- Convex Hull
Zoho Interview Coding Questions:
Easy:
- Frequencies of Limited Range Array Elements
- Ease the Array
- Bitonic Generator Sort
- Key Pair
- Next Greater Even Number
- Element with left side smaller and right side greater
- Index of an Extra Element
- Array Duplicates
- Find missing in second array
- Remove duplicate elements from sorted Array
Medium:
- Number of occurrence
- Largest Number formed from an Array
- Rearrange Array Alternately
- The Celebrity Problem
- Check if frequencies can be equal
- Find the string in grid
- Reverse each word in a given string
- Validate an IP Address
- Look and Say Pattern
- Merge two sorted linked lists
Hard:
LinkedIn Interview Coding Questions:
Easy:
- Binary Search
- Segregate Even and Odd numbers
- Ticket sellers
- Search a node in BST
- Pair with greatest product in array
- Move all zeroes to end of array
- Pair with greatest product in array
- Closest Strings
- Distinct Substrings
- Special Stack
- Check for BST
- Count all possible paths from top left to bottom right
Medium:
- Count the subarrays having product less than k
- Leaves to DLL
- Preorder to BST
- Steps by Knight
- Min distance between two given nodes of a Binary Tree
- Serialize and deserialize a binary tree
- Min distance between two given nodes of a Binary Tree
- Total Decoding Messages
- Find the number of islands
- Count of sum of consecutives
Hard:
Walmart Interview Coding Questions:
Easy:
- Find the highest occurring digit in prime numbers in a range
- Count all possible paths from top left to bottom right
- Parenthesis Checker
- Josephus Problem
- Intersection of Two Linked Lists
- Search in a matrix
- Colorful Strings
- Reverse a linked list
- Queue using two Stacks
Medium:
- Longest consecutive subsequence
- Largest number in K swaps
- Word Break
- Minimum Platforms
- Top View of Binary Tree
- Remove Loop in Linked List
- Max Sum without Adjacents
- Stickler Thief
Hard:
Samsung Interview Coding Questions:
Easy:
- Next greater number set digits
- Finding middle element in a linked list
- Root to leaf path sum
- Left View of Binary Tree
- Implement Queue using Linked List
- Count number of bits to be flipped to convert A to B
- Implement two stacks in an array
- Delete without head pointer
- Move all zeroes to end of array
Medium:
- Longest Increasing Subsequence
- Next larger element
- Permutations of a given string
- Detect Loop in linked list
- Egg Dropping Puzzle
- Total number of possible Binary Search Trees with n keys
- Minimum Jumps
- Missing And Repeating
Hard:
Ola Cabs Interview Coding Questions:
Easy:
- Missing number in array
- Search in a matrix
- Left View of Binary Tree
- K distance from root
- Mirror Tree
- Level order traversal in spiral form
- Non Repeating Character
- Minimum indexed character
- Find the element that appears once in sorted array
Medium:
- Kadane’s Algorithm
- Sort an array of 0s, 1s and 2s
- Connect Nodes at Same Level
- Find the number of islands
- Maximum Difference
- Boolean Matrix Problem
- Quick Sort
- CamelCase Pattern Matching
Hard:
Flipkart Interview Coding Questions:
Easy:
- Finding middle element in a linked list
- Left View of Binary Tree
- Sum of dependencies in a graph
- Reverse Level Order Traversal
- Implement Queue using Stack
- Maximum Width of Tree
- Length Unsorted Subarray
- Count pairs with given sum
Medium:
- Kadane’s Algorithm
- 0 – 1 Knapsack Problem
- Inversion of array
- Consecutive 1’s not allowed
- Get minimum element from stack
- Add two numbers represented by linked lists
- Connect Nodes at Same Level
- Maximum of all subarrays of size k
Hard:
- Smallest range in K lists
- Next Smallest Palindrome
- Matrix Chain Multiplication
- Clone a linked list with next and random pointer
SAP Interview Coding Questions:
Easy:
- Reverse words in a given string
- Remove Spaces from string
- Second Largest
- Check if a number is power of another number
- Reverse a linked list
- BFS traversal of graph
- GCD of Array
- LCM And GCD
- Bubble Sort
Medium:
- Sort an array of 0s, 1s and 2s
- Check if a number is Bleak
- Get minimum element from stack
- Quick Sort
- Heap Sort
- Stock buy and sell II
- Longest K unique characters substring
- Binary Tree to CDLL
Hard:
Visa Interview Coding Questions:
Easy:
- Product Pair
- Search in a matrix
- Find Pair Given Difference
- Does robot moves circular
- Remove Duplicates from a Sorted Linked List
Medium:
- Indexes of Subarray Sum
- Search in a row-column sorted Matrix
- Heap Sort
- Maximum Intervals Overlap
- Longest Palindromic Substring
- Flattening a Linked List
- Intersection Point in Y Shaped Linked Lists
- 0 - 1 Knapsack Problem
- Number of Coins
- Strongly Connected Components (Kosaraju's Algo)
- Find the number of islands
- Count of sum of consecutives
Hard:
VMware Interview Coding Questions:
Easy:
- Check for BST
- Finding middle element in a linked list
- Reverse a linked list
- Run Length Encoding
- Height of Binary Tree
- Mirror Tree
- Longest Common Prefix in an Array
- Common in 3 Sorted Arrays
Medium:
- Longest Common Subsequence
- Maximum Index
- Array to BST
- Egg Dropping Puzzle
- K’th smallest element
- Detect Loop in linked list
- Infix to Postfix
- Diameter of Binary Tree
- Boolean Matrix Problem
Cisco Interview Coding Questions:
Easy:
- Missing number in array
- Reverse words in a given string
- Counbt set bits
- Reverse a linked list
- Does array represent Heap
- Escape the jail
- Insertion Sort
- Bubble Sort
- Swap two nibbles in a byte
- Count all possible paths from top left to bottom right
Medium:
- Permutations of a given string
- Array to BST
- Level order traversal
- Minimum Spanning Tree
- Kth largest element in a stream
- K’th smallest element
- Lowest Common Ancestor in a Binary Tree
- ZigZag Tree Traversal
- Longest Bitonic subsequence
- Negative weight cycle
Goldman Sachs Interview Coding Questions
Easy:
- Reverse words in a given string
- Overlapping rectangles
- Non Repeating Character
- Implement Queue using Stacks
- Check if two arrays are equal or not
- Check for Balanced Tree
- Binary Search in forest
- Smallest subarray with sum greater than x
Medium:
- Column name from a given column number
- Total Decoding Messages
- Sum Tree
- Get minimum element from stack
- Flattening a Linked List
- Sort a stack using Recursion
- Intersection Point in Y Shapped Linked Lists
- Stock buy and sell
- Egg Dropping Puzzle
Hard:
Qualcomm Interview Coding Questions:
Easy:
- Find length of Loop
- Implement strstr
- Left View of Binary Tree
- Check for BST
- Reverse Bits
- Reverse a linked list
- Array Subset of another array
- Set Bits
- Missing in Array
Medium:
- Min distance between two given nodes of a Binary Tree
- Delete a node from BST
- Intersection Point in Y Shapped Linked Lists
- Detect Loop in linked list
- Next Permutation
- Find Prime numbers in a range
- Sort 0s, 1s and 2s
- Merge Sort
PayU Interview Coding Questions:
Easy:
- Leaders in an array
- Pattern Searching
- Level order traversal in spiral form
- Finding middle element in a linked list
- Missing number in array
- Reverse each word in a given string
- Postorder traversal from given Inorder and Preorder traversals
- Non Repeating Character
Medium:
- First non-repeating character in a stream
- Next larger element
- 0 – 1 Knapsack Problem
- Trapping Rain Water
- Implement Atoi
- Lowest Common Ancestor in a Binary Tree
- Flattening a Linked List
- Kadane’s Algorithm
- Count possible ways to construct buildings
- Tree Boundary Traversal
Intuit Interview Coding Questions:
Easy:
- Element with left side smaller and right side greater
- Missing in Array
- Alternate positive and negative numbers
- Count number of free cell
- Pairwise swap elements of a linked list
- Special Stack
- Deletion and Reverse in Linked List
Medium:
- Count Special Numbers
- Stock buy and sell
- Maximum Sub Array
- Count Occurences of Anagrams
- Stock buy and sell II
- Search in a Rotated Array
- Heap Sort
- Largest number in K swaps
- Find the missing no in string
- Word Search
- Sort a stack
- Steps by Knight
Hard:
- Max rectangle
- Making A Large Island
- Reorder List
- Find median in a stream
- Boolean Parenthesization
- Count Lucky Permutations
GeeksforGeeks Courses:
Language Foundation Courses [C Programming / C++ / JAVA / Python]
Learn any programming language from scratch and understand all its fundamentals concepts for a strong programming foundation in the easiest possible manner with help of GeeksforGeeks Language Foundation Courses – C Programming | Java Foundation | Python Foundation | C++ Foundation.
DSA to Development - Coding Guide
For a more comprehensive approach to acing your coding interviews, consider enrolling in the DSA to Development - Coding Guide course from GeeksforGeeks. This course covers a wide range of topics, including those commonly tested by top companies, ensuring you’re fully prepared to tackle any question that comes your way. Give your preparation the boost it needs by exploring this course today.
Start learning Data Structures and Algorithms to prepare for the interviews of top IT giants like Microsoft, Amazon, Adobe, etc. with DSA Self-Paced Course where you will get to learn and master DSA from basic to advanced level and that too at your own pace and convenience.