 # Flipkart Grid 3.0 (SDE1 intern+FTE)

Flipkart Grid 3.0 is a team hackathon contest (You can learn more)

However Our Team didn’t qualify the ideation round, but we got coding round test link.

Coding Round

There were 3 questions

1. A state consists of n cities. All roads in city are bidirectional. We have to find the length of shortest route between two given cities, with a twist that you can eliminate the distance between any “k” connected cities (eliminate a distance means you can make distance between two connected cities as 0, you can do this “k” times).(Link to a similar problem)
3. Coin exchange problem (link to problem)

I solved 2 questions (first and third)

ROUND 1 Technical (No. of Interviewer - 1)

• Given an Integer array, find the smallest missing positive integer in the array. (Link to question)
``````I gave 3 solutions

Approach 1: Time complexity: O(nlogn) Space complexity: O(1)
Approach 2: Time complexity: O(n) Space complexity: O(n)
Approach 3: Time complexity: O(n) Space complexity: O(1)
``````
• Given an integer array, that contains Flipkart coupons with discount, a customer can select coupons from the array but cannot choose 2 consecutive coupons, find max discount. (Link to question)
``````I gave 2 solutions

Approach 1, Time Complexity O(n), Space Complexity: O(n)
Approach 2, Time Complexity O(n), Space Complexity: O(1)
``````
• What is a Complete Binary tree ?
• Max number of nodes having 1 child in a Complete binary tree?
• Max height of a binary tree ? How?
• How to resolve this problem?

At the end the interviewer told me that he is passing me in this round and gave me an open feedback so that I perform better in Round 2. I got the link for Round 2 same day only with 2 hours gap in between.

ROUND 2 Technical (No. of Interviewers - 2)

• Create a class with method names as
``````Shuffle(): which would shuffle an array in random order

reset(): which would return the original array
``````

My Solution:

``````class array_operations{
vector<int> arr;
vector<int> helper;

public:
array_operations(vector<int> nums){
for(auto x : nums)
arr.push_back(x);
}

vector<int> shuffle()
{
int n = arr.size();
helper.clear();
for(int i =0 ; i< n; i++)
{
int r = rand();
R = r % (n);
swap(arr[i], arr[r]);
helper.push_back(r);
}

return arr;
}

vector<int>  reset()
{
for(int i = n-1; i>=0; i--)
swap(arr[i], arr[helper[i]]);
return arr;
}

}

int main(){

vector<int> array = {1,2,3,4,5,6,7,8,9};
Array_operations a(array);
Array = a.shuffle();
Array = a.reset();
}
``````
• Given a binary tree, tell whether it is foldable or not. Foldable means symmetrical in left and right subtree (values doesn’t play any role, at leetcode values do matter) (Link to question)

I got stuck in the first question as the interviewer wanted to shuffle the in random order without using random number generation function, I used many methods like swapping depending on the current time and many other complex swapping strategies, at last interviewer gave me the permission to use random number generating function.

At the end they asked the time complexity of every method and function along with space complexity.

ROUND 3 HM round (No. of Interviewer - 1)

• Given an integer array, divide it into 2 subsequence such that average of both subsequence(taken individually) is equal. (Link to question)

Now normal resume based, regarding projects and hobby.

• Any new feature you want to implement at Flipkart app or website.
• Have you played chain reaction game (app h,main interview mein bahut game game kar chuka tha), how will u design it?
• What happens in the background when we write “virtual” in parent class, how does it do run time polymorphism?
• Rest about CGPA, books I read, Video Editing and FPS Games like Valorant. (I mentioned all these things in interview and resume)

Round 1, Round 2 happened on SmartMeet (In these rounds they didn’t ran my code but in every code asked me to dry run on multiple test cases and asked Time complexity and Space complexity)

Round 3 happened on Google Meet (In this round interviewer asked me to share my screen and open any code editor and ran my code on multiple test cases.)

I’m happy to share that I got the offer.

Important points

• Do not take it as interview, make it a discussion with interviewer (interviewers are very friendly and supportive)
• Take as many test case to validate your approach, it will show your thinking style and approach to solve any problem.
• Be confident and be vocal in the whole process.
4 Likes

Just Wow!!!