# Flipkart Interview Questions : set2

By | May 1, 2014

I recently attended Flipkart Interview process offcampus for the position of SDE1. I’m sharing here my interview experience.

Round 1(Telephonic Interview)

• Write a code to check if a tree is BST or not.
• Modify this code to find the maximum subtree in tree which is a BST. Maximum subtree means subtree goes upto its leaves from any node.
• Modify the code again to find the maximum tree which is a BST. BST can lie anywhere and it may or may not go upto its leaves.
• Round 2 (Onsite Interview)

• There is code like

For simplicity you may assume that there is only one variable declaration on 1 line. Now given a line number, you have to tell what all variables are valid on that line. Propose an algorithm for this.

• Implement LRU cache. Write a code for this. LRU cache supports 3 operations,
put(key, value)
get(key)
remove(key)
• WAP to get the next higher palindrome of a given number.
123 -> 131 1232 -> 1331
• Round 3 (Onsite Interview)

• Implement next_permutation function (similar to what is in algorithm.h).
• Given n sequences, and starting and stopping point of every sequence with its score. For eg.
no of sequences = 5
start stop score
0 4 4
3 10 11
6 8 8
7 15 10
11 15 4
All scores are positive. You have to find the maximum subset of non overlapping sequences having maximum total sum of scores. I proposed a n^2 approach first and then modified it to nlgn.
• Normal discussion on work culture, teams etc.
• Have got some interview questions submit it here.So that we can help other candidates like you to land their dream job

## 2 thoughts on “Flipkart Interview Questions : set2”

1. bharat thakarar

Can you please elaborate more on last question – maximum subset of non overlapping sequences having maximum total sum of scores?

1. InterviewGeek Post author

Hi Bharat ,
Take it like this . Find a sum of sequences such that no sequence in that set ovelap with any other sequence and the sum is maximum