🏒 PhonePe Machine Coding Round – SDE Interview Experience

phonepe logo
phonepe
SDE-1
July 20, 2025 β€’ 4 reads

Summary

I experienced a Machine Coding Round for an SDE-1 role at PhonePe, where I was tasked with designing a Fitness Class Booking System, and successfully implemented key features including user management, class scheduling, booking with waitlists, and concurrency handling, using OOP principles and in-memory storage.

Full Experience

Role: SDE-1
Platform: Onsite/Online (Coding Environment Provided)
Round Type: Machine Coding (Duration: 90–120 mins)
Language Used: Java

πŸ’Ό Problem Statement:

Design a Fitness Class Booking System with the following features:

πŸ‘₯ User Management:

  • Users can register/login with tier-based packages:
    • Platinum β†’ 10 classes
    • Gold β†’ 5 classes
    • Silver β†’ 3 classes

πŸ“… Class Management (Admin Functionality):

  • Create, schedule, and cancel fitness classes (e.g., Yoga, Gym)
  • Each class has a capacity and scheduled time

πŸ“Œ Booking Functionality:

  • Users can book classes based on available slots and their tier limit
  • If the class is full β†’ Add to waitlist
  • On cancellation, the first waitlisted user gets the slot

❌ Cancellation:

  • Users can cancel up to 30 minutes before the class
  • Cancelled bookings restore user’s quota

πŸ”„ Concurrency:

  • Multiple users trying to book at the same time β†’ Thread-safe booking logic was expected

🧠 My Approach:

  • Used OOP Design: Classes like User, FitnessClass, BookingService, etc.
  • Followed Separation of Concerns using service classes
  • Stored everything in-memory using HashMaps/List (no DB required)
  • Used synchronized blocks for thread safety
  • Hardcoded the main flow (register, create class, book, cancel, etc.) for quick testing

βœ… Features Implemented:

  • User registration with package tiers
  • Admin can schedule classes
  • Class booking with capacity checks
  • Waitlist promotion after cancellation
  • Tier-wise booking limits
  • Concurrency-safe booking

Feel free to ask if anyone wants the code or detailed breakdown. Hope this helps for your upcoming rounds! ✌️

Interview Questions (1)

Q1
Design a Fitness Class Booking System
System DesignHard

Design a Fitness Class Booking System with the following features:

πŸ‘₯ User Management:

  • Users can register/login with tier-based packages:
    • Platinum β†’ 10 classes
    • Gold β†’ 5 classes
    • Silver β†’ 3 classes

πŸ“… Class Management (Admin Functionality):

  • Create, schedule, and cancel fitness classes (e.g., Yoga, Gym)
  • Each class has a capacity and scheduled time

πŸ“Œ Booking Functionality:

  • Users can book classes based on available slots and their tier limit
  • If the class is full β†’ Add to waitlist
  • On cancellation, the first waitlisted user gets the slot

❌ Cancellation:

  • Users can cancel up to 30 minutes before the class
  • Cancelled bookings restore user’s quota

πŸ”„ Concurrency:

  • Multiple users trying to book at the same time β†’ Thread-safe booking logic was expected

Preparation Tips

πŸ’‘ Tips for Candidates:

  • Think in real-world object models
  • Start with core functionality, leave enhancements for later
  • Keep code modular and readable
  • Add comments to clarify assumptions and logic
  • Don’t forget edge cases (cancelling, waitlist promotion)
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!