🏢 PhonePe Machine Coding Round – SDE Interview Experience

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-07-20Added By Anonymous
Source: Link

Company: PhonePe
Role: software engineer 1
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

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

💡 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)

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

Comments