Practice

Design LeetCode

Design a coding contest platform like LeetCode.

Functional requirement:

There is a question bank that stores thousands of programming questions. For each question, users can write, compile and submit code against test cases and get results. User submitted code needs to be persisted. Every week, there is a contest where people compete to solve questions as quickly as possible. Users will be ranked based on their accuracy and speed. We’ll need a leaderboard that shows rankings in real time.

Scale requirement:

  • Supporting 10k users participating contests concurrently
  • 1 contest a day
  • Each contest lasts 2 hours
  • Each user submits solutions 20 times on average
  • Each submission executes 20 test cases on average
  • User submitted code have a retention policy of 1 month after which they will be deleted.
  • Assuming that the storage space required for the solution of each coding question is 1KB.
  • Assuming that the Read:write ratio is 100:1.
Step1
Step2
Step3
Step4
1. Resource Estimation