Flipkart has done a drive in Delhi.
Round 1: Machine Coding
You are given some equations which may contain > or = on different-different operand. For example there are valid input and invalid (a=5, b<a=50)
String e1 = "a>b=1";
String e2 = "a>b=2";
String e3 = "a>c>e=3";
String e4 = "a>c>f=4";
String e5 = "b>a=5";
String e6 = "a>b>c=5";
String e7 = "b=7";
String e8 = "a>b>c>d=99";
String e9 = "a>b=99";
You need to create JSON string from it.
{
‘a’: {
‘b’: [1,2,99],
‘c’: {
‘e’:3,
‘f’:4
}
},
‘b’: {
‘a’ : 5
}
}
Highlighted one are invalid because they come they ask for overwrite the data (a>b>c = 5; C has e and f so we can overwrite.
Input: You are given those string in string array
Output:
Construct JSON
Print it
If you print in same as above (nice manner) +point
I solved this problem using Trie
One can see my implementation at here: https://github.com/nitsgupta/practice/tree/master/JAVA/JsonBuilder
Round 2: Face To Face Algo DS
1. Do a level order traversal for a tree where order of printing is reversed on each level.
First i gave O(n2) solution they asked for less complexity solution. I then gave BFS solution by keeping a FIFO queue.
2. You are given a file of parent child relations. Data is huge consist of millions of lines.
parent child a -> b c -> d e -> f
Provide a data structure to keep data in the memory.
Provide a solution to keep data in permanent storage.
3. You are given a 2*2 matrix which contains cost of visiting each cell. You have to find lowest cost path from 0,0 to m,n where cost is minimum.
You can move only in down and right direction.
I gave a DP solution with complexity O(mn)
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Recommended Posts:
- Amazon Interview Experience | Set 185 (For SDE1)
- Amazon interview Experience | Set 141 (For SDE1)
- Amazon Interview Experience | Set 150 (SDE1 for 1 Year Experienced)
- Amazon Interview Experience | Set 153 (For SDE1)
- Bharti SoftBank (Hike) Interview Experience | Set 4 (Off-Campus for SDE1)
- Microsoft Interview Experience | Set 42 (For SDE1)
- Amazon Interview Experience | Set 184 (Off Campus for SDE1)
- Amazon Interview Experience | Set 186 (For SDE1)
- Amazon Interview Experience | Set 187 (For SDE1)
- Amazon Interview Experience | Set 188 (For SDE1)
- Amazon Interview Experience | Set 213 (Off-Campus for SDE1)
- Expedia Interview Experience | Set 7 (4.5 Years Experienced for SDE1)
- Amazon Interview Experience | Set 254 (Off-Campus for SDE1)
- Amazon Interview Experience | Set 256 (Written Test for SDE1)
- Amazon Interview Experience | Set 258 (For SDE1)
- Amazon Interview Experience | Set 259 (1 Yr Experienced for SDE1)
- Amazon Interview Experience | Set 261 (For SDE1)
- Amazon Interview Experience | Set 264 (Experienced for SDE1)
- Amazon Interview Experience | Set 262 (For SDE1)
- Amazon Interview Experience | Set 266 (Off-Campus for SDE1)


