phonepe logo
PhonePeΒ· SDE-1

🏒 PhonePe Machine Coding Round – SDE Interview Experience

Posted
20 Jul 2025
409 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.

How it went

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! ✌️

Questions asked (1)

  1. 01

    Design a Fitness Class Booking System

    System Design Β· Hard

    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

How they prepared

πŸ’‘ 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)

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at PhonePe recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

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