Flipkart SDE2 Machine Coding,PSDS,Design Round questions

flipkart logo
flipkart
SDE II
April 26, 2025 • 5 reads

Summary

I interviewed for an SDE2 role at Flipkart, navigating through Machine Coding, PSDS, and Design rounds. While I successfully cleared the first two, I felt I performed poorly in the Design round and subsequently received a rejection.

Full Experience

Hi community,
I recently gave flipkart SDE2 interviews, I filled a google form circulated by a recruiter, Then next day I had machine coding round(on saturday), following monday I had machine coding evaluation round.
He asked me what design i used, which design will be used if I want to do some async task then ran some test cases on my code.

Problem Statement:

Ecommerce with Loyalty Program - Machine Coding Round Problem Statement: Design a service that adds gamification elements to an e-commerce platform. This service will track user transactions, allowing users to purchase products, redeem existing points during purchases (with constraints based on user level), and earn new points from those purchases. The service should incentivize purchases and engagement using points and levels, and it should be designed to be flexible and extensible. Functionalities Required: Onboard User Onboard user to our platform onboard <user_name>

User Points: Users earn points for every purchase. The service calculates points based on the user's level and the purchase amount: For every ₹100 spent, users earn points as follows: Bronze: 10 points Silver: 12.5 points Gold: 15 points Users can view their current point balance.

User Levels: Users progress through levels based on accumulated points: Bronze: 0 - 499 points Silver: 500 - 999 points Gold: 1000+ points Each level has associated benefits (redemption limits and point earning rates).

Purchase Products with Points Redemption: Users can purchase products. Users can redeem existing points to pay for a portion of the purchase. Redemption Rules: The percentage of the purchase that can be paid with points and the capped limit on points redeemed are based on the user's level: Bronze: Maximum redemption percentage: 5% of the purchase amount. Maximum points redeemable: 200 points. Silver: Maximum redemption percentage: 10% of the purchase amount. Maximum points redeemable: 500 points. Gold: Maximum redemption percentage: 15% of the purchase amount. Maximum points redeemable: 1000 points. Users can choose to redeem less than or equal to points eligible for redemption Users also earn points on the remaining amount paid with actual money (based on their level and the ₹100 = 10 points rule). purchase <user_name> <order_amount> <points_to_redeem>

Get User's Stats User can choose to view below details Current level, points

Personalized Discount (Bonus): Calculate a personalized discount for each user on their current purchase based on their past purchase history. Discount Calculation Rules: If the user has placed more than 3 orders, apply a 5% discount on the current purchase. If the user's total spending is greater than ₹10,000, apply a 10% discount on the current purchase. If both conditions are true, apply a 12% discount on the current purchase. The discount is applied after any point of redemption. The discount should be capped at ₹5000. Post redemption of this offer, eligibility will be refreshed (will again require at least 3 order or spent at least 10k to be re-eligible) Sample Test Cases: Test Steps: Bronze Purchase:

Input: purchase user1 800.00 0 Verify: Points Calculation: (800 / 100) * 10 = 80 points Output: Purchase successful. Points added: 80. Total payable amount: 800.00. Current points: 80. Current level: Bronze orders count : 1 Bronze Purchase: input: purchase user1 4200.00 100 Output: Purchase Failed. Not enough points to redeem Bronze Purchase (Approaching Silver):

Input: purchase user1 4200.00 0 Verify: Points Calculation: (4200 / 100) * 10 = 420 points Output: Purchase successful. Points added: 420. Total payable amount: 4200.00. Current points: 500. Current level: Silver orders count : 2 Silver Purchase (With Redemption):

Input: purchase user1 3000.00 300 Verify: Redemption allowed: Yes (Silver max redemption: 500) Amount after redemption: 3000 - 300 = 2700 Points Calculation: (2700 / 100) * 12.5 = 337.5 points Output: Purchase successful. Points redeemed: 300. Points added: 337.5. Total payable amount: 2700.00. Current points: 537.5. Current level: Silver orders count : 3 Silver Purchase (Approaching Gold):

Input: purchase user1 5000.00 0 Verify: Points Calculation: (5000 / 100) * 12.5 = 625.0 points Output: Purchase successful. Points added: 625.0. Total payable amount: 5000.00. Current points: 1162.5. Current level: Gold orders count : 4 Gold Purchase (With Redemption, Discount): [BONUS PART]

*Assume user1 now qualifies for a 5% discount (orders > 3). Input: purchase user1 12000.00 800 0 Verify: Redemption allowed: Yes (Gold max redemption: 1000) Amount after redemption: 12000 - 800 = 11200 Discount Calculation: 11200 * 0.05 = 560.0 Amount after discount: 11200 - 560 = 10640.0 Points Calculation: (10640 / 100) * 15 = 1596.0 Output: Purchase successful. Points redeemed: 800. Points added: 1596.0. Discount applied: ₹560.0. Total payable amount: 10640.0. Current points: 1958.5. Current level: Gold orders count : 5 Final Points Check:

Input: getUserStats user1 Verify: Output: user1 has 1958.5 points. Current level: Gold.

Guidelines: Time: 90mins Write modular and clean code. A driver program/main class/test case is needed to test out the code by the evaluator with multiple test cases. But do not spend too much time in the input parsing. Keep it as simple as possible. Evaluation criteria: Demoable & functionally correct code, Code readability, Proper Entity modelling, Modularity & Extensibility, Separation of concerns, Abstractions. Use design patterns wherever applicable You are not allowed to use any external databases like MySQL. Use only in memory data structures. No need to create any UX Please focus on the Bonus Feature only after ensuring the required features are complete and demo-able. Use of Gen AI or any other tool to write code is prohibited
Verdict: Passed

Round 2: PSDS Round:
Problems asked were like this


PSDS Round questions:

Given a positive integer n such that n > 2. Divide numbers from 1 to n in two groups such that the absolute difference of sum of each group is minimum. Print the 2 groups Example: Input : 5 Output :[ [5 2], [4, 3,1]]

Follow up on the same Given a positive integer n such that n > 2. Divide numbers from 1 to n in k groups such that the absolute difference of sum of each group is minimum. Print the 2 groups Example: Input : 5 Output :[ [5 2], [4, 3,1]] Then asked me to optimise the approach as i suggested O(NK) then optimised it by using priority queue O(NLogK)

#2 Design a stack-like data structure to push elements to the stack and pop the most frequent element from the stack.

Implement the FreqStack class:

FreqStack() constructs an empty frequency stack. void push(int val) pushes an integer val onto the top of the stack. int pop() removes and returns the most frequent element in the stack. If there is a tie for the most frequent element, the element closest to the stack's top is removed and returned.

Example 1:

Input ["FreqStack", "push", "push", "push", "push", "push", "push", "pop", "pop", "pop", "pop"] [[], [5], [7], [5], [7], [4], [5], [], [], [], []] Output [null, null, null, null, null, null, null, 5, 7, 5, 4]

This round went so well from my side as I solved all questions.
Verdict: Passed

Round 3: Design Round
Recruiter called me on thursday saying you have design round tomorrow, as I was supposed to be in office, I told her to move this either to saturday or monday, she said she has to complete everything by wednesday.
She scheduled design round on friday 4PM and rescheduled to 2PM.
The questions asked were like this

Design Round question:

Design a ticket booking system for movies. For example: bookmyshow Functionality to be implemented: ā— Search movie(by name, by theatre name) ā— Book ticket ā— Cancel ticket ā— List upcoming movies I was told to write first human interfaces,not any language specific just human interface then I was told to design DB and freedom to choose any db, and then he found mistakes in each table.

PS: I messed this round as I lacked multiple basics and interviewer pointed out. Interviewer was helpful and it went for 1.5hrs
Verdict: Self rejecting myself
Edit: Got the rejecion mail

Interview Questions (5)

Q1
Ecommerce with Loyalty Program - Machine Coding Round
System Design

Problem Statement:

Ecommerce with Loyalty Program - Machine Coding Round
Problem Statement:
Design a service that adds gamification elements to an e-commerce platform. This service will track user transactions, allowing users to purchase products, redeem existing points during purchases (with constraints based on user level), and earn new points from those purchases. The service should incentivize purchases and engagement using points and levels, and it should be designed to be flexible and extensible.
Functionalities Required:
Onboard User
Onboard user to our platform
onboard <user_name>

User Points: Users earn points for every purchase. The service calculates points based on the user's level and the purchase amount: For every ₹100 spent, users earn points as follows: Bronze: 10 points Silver: 12.5 points Gold: 15 points Users can view their current point balance.

User Levels: Users progress through levels based on accumulated points: Bronze: 0 - 499 points Silver: 500 - 999 points Gold: 1000+ points Each level has associated benefits (redemption limits and point earning rates).

Purchase Products with Points Redemption: Users can purchase products. Users can redeem existing points to pay for a portion of the purchase. Redemption Rules: The percentage of the purchase that can be paid with points and the capped limit on points redeemed are based on the user's level: Bronze: Maximum redemption percentage: 5% of the purchase amount. Maximum points redeemable: 200 points. Silver: Maximum redemption percentage: 10% of the purchase amount. Maximum points redeemable: 500 points. Gold: Maximum redemption percentage: 15% of the purchase amount. Maximum points redeemable: 1000 points. Users can choose to redeem less than or equal to points eligible for redemption Users also earn points on the remaining amount paid with actual money (based on their level and the ₹100 = 10 points rule). purchase <user_name> <order_amount> <points_to_redeem>

Get User's Stats User can choose to view below details Current level, points

Personalized Discount (Bonus): Calculate a personalized discount for each user on their current purchase based on their past purchase history. Discount Calculation Rules: If the user has placed more than 3 orders, apply a 5% discount on the current purchase. If the user's total spending is greater than ₹10,000, apply a 10% discount on the current purchase. If both conditions are true, apply a 12% discount on the current purchase. The discount is applied after any point of redemption. The discount should be capped at ₹5000. Post redemption of this offer, eligibility will be refreshed (will again require at least 3 order or spent at least 10k to be re-eligible) Sample Test Cases: Test Steps: Bronze Purchase:

Input: purchase user1 800.00 0 Verify: Points Calculation: (800 / 100) * 10 = 80 points Output: Purchase successful. Points added: 80. Total payable amount: 800.00. Current points: 80. Current level: Bronze orders count : 1 Bronze Purchase: input: purchase user1 4200.00 100 Output: Purchase Failed. Not enough points to redeem Bronze Purchase (Approaching Silver):

Input: purchase user1 4200.00 0 Verify: Points Calculation: (4200 / 100) * 10 = 420 points Output: Purchase successful. Points added: 420. Total payable amount: 4200.00. Current points: 500. Current level: Silver orders count : 2 Silver Purchase (With Redemption):

Input: purchase user1 3000.00 300 Verify: Redemption allowed: Yes (Silver max redemption: 500) Amount after redemption: 3000 - 300 = 2700 Points Calculation: (2700 / 100) * 12.5 = 337.5 points Output: Purchase successful. Points redeemed: 300. Points added: 337.5. Total payable amount: 2700.00. Current points: 537.5. Current level: Silver orders count : 3 Silver Purchase (Approaching Gold):

Input: purchase user1 5000.00 0 Verify: Points Calculation: (5000 / 100) * 12.5 = 625.0 points Output: Purchase successful. Points added: 625.0. Total payable amount: 5000.00. Current points: 1162.5. Current level: Gold orders count : 4 Gold Purchase (With Redemption, Discount): [BONUS PART]

*Assume user1 now qualifies for a 5% discount (orders > 3). Input: purchase user1 12000.00 800 0 Verify: Redemption allowed: Yes (Gold max redemption: 1000) Amount after redemption: 12000 - 800 = 11200 Discount Calculation: 11200 * 0.05 = 560.0 Amount after discount: 11200 - 560 = 10640.0 Points Calculation: (10640 / 100) * 15 = 1596.0 Output: Purchase successful. Points redeemed: 800. Points added: 1596.0. Discount applied: ₹560.0. Total payable amount: 10640.0. Current points: 1958.5. Current level: Gold orders count : 5 Final Points Check:

Input: getUserStats user1 Verify: Output: user1 has 1958.5 points. Current level: Gold.

Guidelines: Time: 90mins Write modular and clean code. A driver program/main class/test case is needed to test out the code by the evaluator with multiple test cases. But do not spend too much time in the input parsing. Keep it as simple as possible. Evaluation criteria: Demoable & functionally correct code, Code readability, Proper Entity modelling, Modularity & Extensibility, Separation of concerns, Abstractions. Use design patterns wherever applicable You are not allowed to use any external databases like MySQL. Use only in memory data structures. No need to create any UX Please focus on the Bonus Feature only after ensuring the required features are complete and demo-able. Use of Gen AI or any other tool to write code is prohibited

Q2
Divide numbers 1 to N into two groups with minimum sum difference
Data Structures & Algorithms

Given a positive integer n such that n > 2. Divide numbers from 1 to n in two groups such that the absolute difference of sum of each group is minimum. Print the 2 groups

Example:
Input : 5
Output :[ [5 2], [4, 3,1]]

Q3
Divide numbers 1 to N into K groups with minimum sum difference
Data Structures & Algorithms

Follow up on the same

Given a positive integer n such that n > 2. Divide numbers from 1 to n in k groups such that the absolute difference of sum of each group is minimum. Print the 2 groups

Example:
Input : 5
Output :[ [5 2], [4, 3,1]]

Q4
Design FreqStack (Most Frequent Stack)
Data Structures & Algorithms

Design a stack-like data structure to push elements to the stack and pop the most frequent element from the stack.

Implement the FreqStack class:

  • FreqStack() constructs an empty frequency stack.
  • void push(int val) pushes an integer val onto the top of the stack.
  • int pop() removes and returns the most frequent element in the stack.

If there is a tie for the most frequent element, the element closest to the stack's top is removed and returned.

Example 1:

Input
["FreqStack", "push", "push", "push", "push", "push", "push", "pop", "pop", "pop", "pop"]
[[], [5], [7], [5], [7], [4], [5], [], [], [], []]
Output
[null, null, null, null, null, null, null, 5, 7, 5, 4]
Q5
Design a Movie Ticket Booking System
System Design

Design a ticket booking system for movies. For example: bookmyshow

Functionality to be implemented:

  • Search movie(by name, by theatre name)
  • Book ticket
  • Cancel ticket
  • List upcoming movies

I was told to write first human interfaces,not any language specific just human interface then I was told to design DB and freedom to choose any db, and then he found mistakes in each table.

Preparation Tips

Scope of Improvement: If you are doing LLD keep coding that by yourself,
Because speed matters and think in a direction of scalability.
When we see LLD/HLD videos we think whatever is being taught, besides that think in the direction of scalability.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!