# Flipkart Interview Experience for SDE-1 (On-Campus 2019)

** Eligibility**: 5 CPI and above

207 students were eligible for coding round

**Coding Round (HackerRank): 90 minutes; 3 questions sorted difficulty wise**

Question 1 : basic implementation of Hashing given 2 strings

Question 2 : sliding window technique

There is a meeting scheduled in an office that lasts for time t and starts at time 0. In between the meeting there are n presentations whose start and end times are given i.e. the ith presentation starts at s[i] and ends at e[i]-1. The presentations do not overlap with each other. You are given k, the maximum number of presentations that you can reschedule keeping the original order intact. Note that the duration of the presentation can’t be changed. You can only change the start and end time. Your task is to maximize the longest time period in which there is no presentation scheduled during the meeting.

Constraints :-

1<=t<=1, 000, 000, 000

0<=k<=n

1<=n<=100, 000

e[i]<=s[i+1], 0<=i <n-1

s[i] < e[i] for 0<=i<=n-1

Question 3 : 2-D Dp problem

**INTERVIEW-:**

**23 selected**

**in addition there was a wait list of 5 Extended Wait list of 7 (although wait list and extended wait list were never called for interview)**

Note-: every approach you tell and the optimization you do will be noted down; hint you will be given will also be noted; lesser the hints, more the chance of selection

**Round 1:**

30 minutes; no resume; no introduction; 2 questions; proper coding

Question 1 : given an array find maximum of a[i]+a[j] where |i-j|>1 i.e. i and j are not adjacent

Solution: O(n) space dp(not acceptable)

4 maximum of array with pseudo code

Question 2 : given a complete binary tree with sorted levels

Input : 1 / \ / \ 5 6 / \ / \ / \ / \ 7 8 9 16 search for an element ( no extra space ) brute force-: O(n) simple traversal of tree

solution required -: assume the element is present and first find the level of the given element by seeing leftmost node of every level in log(N) time

now apply binary search on the level

binary search can be applied in 2 ways

1-: reducing the tree by going on left or right subtree after every middle search where middle element can be rightmost node of left subtree or leftmost node of right subtree

2-: one interesting fact that can be used is binary representation of a number can help you to reach on that node

for example if it is 4th level and node is 5(numbering leftmost node of that level from 0) represent 101

1 means traverse right while 0 means traverse left

1 / \ 2 5 / \ / \ 7 8 10 12 / \ / \ / \ 14 15 16 17 18 19 19 is on node 5(101 or RLR) from 1-(right)->5 -(left)->10 -(right)-> 19

Time Complexity-: log(N) * log(N)

14 qualified for round 2

**Round 2: HR cum Technical**

resume based questions

1. working of vectors in c++

2. project discussion (major part of interview)

3. connectivity of tables in your project

4. Type of normalizations

5. BCNF definition and why i have usedmit in my project

6. your planning for next 3 years

7. why flipkart??

after i told him that answer, he asked from where have you copied the answer and i said i have done my homework well so he asked me another question that is-:

8. how do you prepare for placements

IB for coding, GFG for subjects and HR from various blogs

9. languages you know

etc.

8 students qualified for final round

**Round 3:**

30 minutes extended for an hour

he asked how was i feeling

“Hungry for both, food and Flipkart”, i replied.

“choose any one food or flipkart.” he added

i said “after getting placed i would love to have dinner with you”.

impressed by the answer he began the interview

Question 1-: given a series of intervals with some profit value associated with them

you cannot choose overlapping intervals and have to maximize the profit

let the given set of intervals be in format {start time, end time, value}{{1, 3, **100**}, {2, 4, **200**}, {5, 7, **500**}, {6, 8, **600**}, {1, 100, **800**} }

answer choose interval 2 and 4 or choose interval 5

maximum profit is 200+600 = 800

O(N^2) time complexity DP code was accepted but required solution was O(N*logN)

Question 2-:

extended version of https://www.geeksforgeeks.org/minimum-steps-reach-target-knight/

2a-: given a source and destination on an infinite plane

reach destination in minimum steps moving like knight(in chess)

2b-: cross questioning on your approach why BFS but not DFS

2c-: map or 2-d matrix data structure for isvisited() function ??

2d-: blocking some **FINITE** points on the plane now will you approach work ? if no, correct it

answer is to apply BFS from both the ends and if any of the 2 given queues are empty then not possible to reach

2e-: time complexity and space complexity of your code

Question 3-: given a matrix of 0’s and 1’s

find a maximum length X formed using 1

11110 110 01011 0 1 0 BOLD 1's form a X of length 3 Brute Approach-:

assume m[i][j] to be center of X and traverse for 1’s in 4 diagonals complexity O( m*n*(m+n) )

accepted solution was O(4*m*n) space memoization and O(m*n)time complexity

where dp[i][j][0], dp[i][j][1], dp[i][j][2], dp[i][j][3] store the maximum number of 1’s till now for four diagonals (upper left, upper right, lower left and lower right) respectively of m[i][j]

**at last 5 were selected for full time role 🙂**