Company Wise Different Questions
Company Wise Different Questions
Write a program with output for the following questions in any programming
language c, c++, java python:
Facebook :
1. Subarray with given sum
2. Find all pairs with a given sum
3. Total Decoding Messages
4. Word Boggle
5. Activity Selection
6. Minimum Depth of a Binary Tree
7. Implement strstr
8. Multiply two strings
9. K-Palindrome
10. Find triplets with zero sum
11. Largest subset whose all elements are Fibonacci numbers
12. Look-and-Say Sequence
13. Converting Decimal Number lying between 1 to 3999 to Roman Numerals
14. Convert Ternary Expression to Binary Tree
15. Maximum Rectangular Area in a Histogram
Amazon :
1. K largest elements from a big file or array
2. Reverse a Linked List in groups of given size
3. Implement a stack with push(), pop() and min() in O(1) time
4. Add two numbers represented by linked lists
5. Convert a Binary tree to DLL
6. Stock span problem
7. Next larger element
8. Edit distance
9. Maximum of all subarrays of size k
10. Pythagorean Triplet
11. Print a Binary Tree in Vertical Order
12. Level order traversal
13. Smallest window in a string containing all the characters of another string
14. Find the number of islands
15. Detect and Remove Loop in a Linked List
16. Check if a binary tree is BST or not
17. Boolean Parenthesization
18. Arrange given numbers to form the biggest number
19. Implement LRU Cache
20. Maximum difference between node and its ancestor in Binary Tree
Cisco :
1. Missing number in array
2. Reverse words in a given string
3. Permutations of a given string
4. Array to BST
5. Counbt set bits
6. Reverse a linked list
7. Level order traversal
8. Minimum Spanning Tree
9. Does array represent Heap
10. Kth largest element in a stream
11. Escape the jail
12. K’th smallest element
13. Insertion Sort
Bubble Sort
Microsoft :
1. Key Pair
2. Is Binary Number Multiple of 3
3. Kadane’s Algorithm
4. Missing number in array
5. Majority Element
6. Search in a Rotated Array
7. Check for BST
8. Finding middle element in a linked list
9. Root to leaf path sum
10. Reverse a linked list
11. Remove every k’th node
12. Merge 2 sorted linked list in reverse order
13. Longest Even Length Substring such that Sum of First and Second Half is
same
14. k largest(or smallest) elements in an array | added Min Heap method
15. Write an Efficient Function to Convert a Binary Tree into its Mirror Tree
16. Determine if Two Trees are Identical
Adobe :
1. Search in a Rotated Array
2. Subset Sum Problem
3. Reverse words in a given string
4. Sort an array of 0s, 1s and 2s
5. Minimum number of jumps
6. Check for BST
7. Root to leaf path sum
8. Sum Tree
9. Finding middle element in a linked list
10. Reverse a linked list
11. Level order traversal in spiral form
12. Right View of Binary Tree
13. Remove duplicate element from sorted Linked List
14. Merge Sort for Linked List
15. Count set bits in an integer
Oracle :
1. 0 – 1 Knapsack Problem
2. Search in a matrix
3. Power of 2
4. Palindrome
5. Root to leaf path sum
6. Kadane’s Algorithm
7. Binary Search
8. Implement Queue using Linked List
9. Connect Nodes at Same Level
10. Remove loop in Linked List
11. Implement Stack using Queues
12. Implement Queue using Stacks
13. Remove duplicate element from sorted Linked List
14. Search in a row wise and column wise sorted matrix
15. Find the first repeating element in an array of integers
D E Shaw :
1. Majority Element
2. Search in a Rotated Array
3. Sum of Middle Elements of two sorted arrays
4. Non Repeating Character
5. Kadane’s Algorithm
6. Intersection of two sorted Linked lists
7. Detect Loop in linked list
8. Print all nodes that don’t have sibling
9. Two Mirror Trees
10. Intersection Point in Y Shapped Linked Lists
11. Trie | (Insert and Search)
12. Implement Queue using Stacks
13. Implement Stack using Queues
14. Find the number of islands
15. Copy Set Bits in Range
Directi :
1. Maximum of all subarrays of size k
2. Search in a matrix
3. Word Boggle
4. Jumping Numbers
5. Transform String
6. Solve the Sudoku
7. Find Nth root of M
8. Array Pair Sum Divisibility Problem
9. Largest zigzag sequence
10. Maximum Intervals Overlap
11. Max rectangle
12. Maximum path sum
13. Maximize Dot Product
14. Excel Sheet | Part – 1
15. Probability of Knight
MAQ Software :
Yahoo :
1. First non-repeating character in a stream
2. Find median in a stream
3. Largest prime factor
4. Form coils in a matrix
5. Word Boggle
6. Largest Product Palindrome
7. Surpasser Count
8. Return two prime numbers
9. Sort a stack
10. Three way partitioning
11. LRU Cache
12. Serialize and Deserialize a Binary Tree
13. Split a Circular Linked List into two halves
14. Interleaved Strings
15. Max Sum without Adjacents
Accolite :
1. Count Squares
2. Longest Prefix Suffix
3. N-Queen Problem
4. Coin Change
5. Permutations of a given string
6. Stock buy and sell
7. Longest Palindrome in a String
8. Sum of two numbers represented as arrays
9. Max sum submatrix
10. Maximum sum Rectangle
11. Root to leaf path sum
12. Lowest Common Ancestor in a Binary Tree
13. Level order traversal in spiral form
14. Implement Stack using Queues
15. n’th node from end of linked list
Walmart Labs :
1. Longest consecutive subsequence
2. Largest number in K swaps
3. k largest elements
4. Word Break
5. Find the highest occurring digit in prime numbers in a range
6. Count all possible paths from top left to bottom right
7. Minimum Platforms
8. Parenthesis Checker
9. Implement LRU Cache
10. Josephus Problem
11. Top View of Binary Tree
12. Intersection of Two Linked Lists
13. Alien Dictionary
14. Remove Loop in Linked List
15. Wildcard Pattern Matching
Samsung :
1. Longest Increasing Subsequence
2. Next larger element
3. Permutations of a given string
4. Next greater number set digits
5. Finding middle element in a linked list
6. Root to leaf path sum
7. Detect Loop in linked list
8. Left View of Binary Tree
9. Implement Queue using Linked List
10. Egg Dropping Puzzle
11. Total number of possible Binary Search Trees with n keys
12. Count number of bits to be flipped to convert A to B
13. Implement two stacks in an array
14. Given only a pointer/reference to a node to be deleted in a singly linked
list, how do you delete it?
Paytm :
1. Sort an array of 0s, 1s and 2s
2. Reverse words in a given string
3. Reverse a linked list
4. Reverse a Linked List in groups of given size
5. Max Sum without Adjacents
6. Mirror Tree
7. Flattening a Linked List
8. Check for Balanced Tree
9. Find the number of islands
10. Coin Change
11. Count frequencies of all elements in array in O(1) extra space and O(n)
time
12. Convert array into Zig-Zag fashion
13. Find the row with maximum number of 1s
14. Maximum Rectangular Area in a Histogram
Ola Cabs :
1. Kadane’s Algorithm
2. Missing number in array
3. Sort an array of 0s, 1s and 2s
4. Search in a matrix
5. Left View of Binary Tree
6. Mirror Tree
7. Connect Nodes at Same Level
8. K distance from root
9. Level order traversal in spiral form
10. Non Repeating Character
11. Find the number of islands
12. Find the character in first string that is present at minimum index in second
string
13. Maximum difference between two elements such that larger element
appears after the smaller number
14. Find the element that appears once in sorted array
15. Boolean Matrix Problem
Flipkart :
1. Kadane’s Algorithm
2. 0 – 1 Knapsack Problem
3. Inversion of array
4. Consecutive 1’s not allowed
5. Finding middle element in a linked list
6. Get minimum element from stack
7. Left View of Binary Tree
8. Add two numbers represented by linked lists
9. Connect Nodes at Same Level
10. Sum of dependencies in a graph
11. Maximum of all subarrays of size k
12. Possible words from Phone digits
13. Reverse Level Order Traversal
14. Implement Queue using Stack
15. Maximum Width of Tree
SAP Labs :