Flipkart interview prep
4 practice questions on the topics candidates reported from Flipkart interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
DSA 4
-
You must decide whether an array has i < j < k with a[i] < a[j] < a[k], in O(n) time and O(1) extra space. What do you keep while scanning once?
- The largest and second-largest values
- A sorted copy of the array
- How many adjacent pairs are increasing
- The smallest value so far, and the smallest value seen that has a smaller value before it
Show the answer
D. The smallest value so far, and the smallest value seen that has a smaller value before it
Keep first (the smallest so far) and second (the smallest value that has something smaller before it). Any value above second completes a triplet. A new value below first replaces first without spoiling the pair second already records.
This topic is named in a candidate’s interview report: SDE-1 interview, on GeeksforGeeks.
-
On a snakes and ladders board of 100 cells, what finds the least number of dice throws needed to reach cell 100?
- Depth-first search, stopping at the first path that reaches 100
- Breadth-first search over the cells, each throw an edge to one of the next six cells (after any ladder or snake)
- Greedy: always throw a 6
- Sorting the ladders by length
Show the answer
B. Breadth-first search over the cells, each throw an edge to one of the next six cells (after any ladder or snake)
Every throw costs the same, so this is a shortest path in an unweighted graph, which BFS finds. A ladder or snake just moves where an edge ends. Always taking 6 can miss a ladder that a smaller throw would land on.
This topic is named in a candidate’s interview report: SDE-1 interview, on GeeksforGeeks.
-
A stock's span on a day is the number of days in a row, ending with that day, on which the price was at most that day's price. Prices over five days are 30, 20, 25, 40, 35. What are the spans?
- 1 1 2 4 1
- 1 1 2 3 1
- 1 2 3 4 5
- 1 1 1 4 1
Show the answer
A. 1 1 2 4 1
25 covers itself and 20, so 2. 40 covers all four days so far, so 4. 35 is below 40, so 1. A stack of the days not yet beaten gives every span in O(n), the same idea as the next greater element.
This topic is named in a candidate’s interview report: SDE-1 interview, on GeeksforGeeks.
-
Using a sliding window, what is the largest sum of 3 consecutive elements of [2, 1, 5, 1, 3, 2]?
- 8
- 7
- 9
- 6
Show the answer
C. 9
The windows sum to 8, 7, 9 and 6. Each step adds the new element and subtracts the one that left, so the whole scan is O(n) instead of re-adding k numbers each time.
This topic is named in a candidate’s interview report: SDE intern (GRiD) interview, 2026, on Reddit.