1. Two Sum
2. Most Common Word
3. Reorder Log files
4.Trapping Rain Water
5.Copy List With Random Pointer
6.Number of Islands
7. Lowest common ancestor of Binary tree
8.Binary Tree Zig zag level order traversal
9. Word Ladder 1 , 2
10. word search 1 , 2
11. Meetings rooms 1 , 2
12. Kth largest element in array.
13. K closest points to Origin.
14.Longest Palindromic Substring.
15. LRC Cache
16. Tic Toc Toe
17. Leetcode all design questions.
18. Prison cells after N days.
19. word break 2
20. stream of characters (DNA Sequence )
21.
2. Most Common Word
3. Reorder Log files
4.Trapping Rain Water
5.Copy List With Random Pointer
6.Number of Islands
7. Lowest common ancestor of Binary tree
8.Binary Tree Zig zag level order traversal
9. Word Ladder 1 , 2
10. word search 1 , 2
11. Meetings rooms 1 , 2
12. Kth largest element in array.
13. K closest points to Origin.
14.Longest Palindromic Substring.
15. LRC Cache
16. Tic Toc Toe
17. Leetcode all design questions.
18. Prison cells after N days.
19. word break 2
20. stream of characters (DNA Sequence )
21.
Given a 2d array in which each row is sorted and rotated, you need to come up with an algorithm which efficiently sort the entire 2d matrix in descenting order.
eg:
input: arr[][] = {
{41, 45, 20, 21},
{1 ,2, 3, 4},
{30, 42, 43, 29 },
{16, 17, 19, 10}
}
input: arr[][] = {
{41, 45, 20, 21},
{1 ,2, 3, 4},
{30, 42, 43, 29 },
{16, 17, 19, 10}
}
output: {
{ 45, 43, 42, 41},
{30, 29, 21, 20},
{19, 17, 16, 10},
{4, 3, 2, 1}
}
{ 45, 43, 42, 41},
{30, 29, 21, 20},
{19, 17, 16, 10},
{4, 3, 2, 1}
}
Interviewer was expecting the solution to run with a complexity < O(n^3) solution.
23. https://leetcode.com/problems/top-k-frequent-elements/
nput is in <productId, timeStamp> format. So assume you have a list of productIDs and their timestamps which they were accessed:
[<product1, timestamp1>, <product2, timestamp2>, <product3, timestamp3>, ...]
Find the top K products purchased in the last one hour.
24. We have two Queues where each queue contains timestamp price pair. We have to return list of list[[price1, price 2]] for all those timestamps where abs(ts1-ts2) <= 1 second where ts1 and price1 are the from the first queue and ts2 and price2 are from the second queue.
Follow up:- one queue is slow
25.Deep copy of an N-ary tree.
public TreeNode clone(TreeNode root) {
if (root == null) {
return null;
}
TreeNode rootClone = new TreeNode(root.val);
for (TreeNode child : root.children) {
TreeNode childClone = clone(child);
rootClone.children.add(childClone);
}
return rootClone;
}
private static class TreeNode {
int val;
List<TreeNode> children = new ArrayList<>();
public TreeNode() {
}
public TreeNode(int val) {
this.val = val;
}
}
26.https://leetcode.com/problems/subsets/
ay we have a machine which scans a printed word and assigns a probablity to each character of the word.
For example, if we scan LBC
, the machine produces the following map for the word (first list will be for the first char, second list for the second char etc.) :
{
['L': 90, 'I': 50, 'N': 10], // for first character (L)
['B': 95, '8': 80, 'S': 15], // for secodn character (B)
['C': 90, 'O': 90, 'D': 70] // for third character (C)
}
Meaning for the first character there is a 90 percent chance that it is L
, 50 percent that it is I
etc.
Given a list of Strings, return the word with the highest probablity based on this map. For example, if the list is {LBD, IBC, LSD}
, LBD
should be returned (with the probablity of 90 + 95 + 70).
27. Consider that there are 26 tables, listed from A to Z. Each table is connected with table next to it. A connected to B, B to C so forth and so on till Z.
How will you connect table A and Z with minimum number of joins?
There are two anagram strings, what is the minimum number of swaps required to match one string to another? You can swap any 2 characters. What is time complexity?
Example 1:
Input: s1 = "AABC", s2 = "AACB"
Output: 1
Explanation: swap 'B' and 'C' AABC => AACB
29.
Position: SDE2
Design a configuration management system
- User should be able to add configuration
- User should be able to delete configuration
- User should be able to search for configuration
- User should be able to subscribe to Configuration So that any updates in configuration will gets notfied to user
30.I have my amazon interview coming up for SDE in seattle. One of my friends recently went on-site in Seattle and was asked this question in OOD. I have not been able to find a good approach to this question. Any suggestions would be helpful
implemnet linux find command as an api ,the api willl support finding files that has given size requirements and a file with a certain format like
- find all file >5mb
- find all xml Assume file class { get name() directorylistfile() getFile() create a library flexible that is flexible Design clases,interfaces.
31. https://leetcode.com/problems/analyze-user-website-visit-pattern
32. Given an array of strings, you need to group isomorphic strings together.
Example:
Input: ["apple", "apply", "dog", "cog", "romi"]
Output: [["dog", "cog"], ["romi"], ["apple", "apply"]]
33. Load Packages
No comments:
Post a Comment