Design Online Coding Platform CODING BLOX (Design Leetcode LLD)
Functionalities/Requirements:
full problem statement & solution (Time given 90min) : http://bit.ly/leetcode-low-level-design
Simply I follow these steps for any LLD.
Step 1,2 and 3 => approx 30min
Step 4 => +1hr
Step 1, 2: Domain layer
Step 3: Database/dao layer
Step 4: Service layer
(Use this hashmap template to quick start: http://bit.ly/lld-hashmap-as-db-template )
Step 0: Understand the problem statement and requirements
Step 1: List down important entities/model/domain
In the above question list of entities are -> User, Contest, and Question

Step 2: List down the relationship between entities.
e.g.
User can register for multiple contests
User:
List<Contest> contestsThe contest can have multiple Questions
Contest:
List<Question> questionsNow Add other fields of entities
User:
username
score
List<Contest> contests -- (A)Contest:
name
level
status
List<Question> questionsQuestion:
question
level
score

Step 3: Store entities and write entities CRUD methods (Use Method 1)
Method 1: Use hashMap to store entities,
Map<Long, User> userDb
Map<Long, Question> questionDb
Map<Long, Contest> contestDbWrite CRUD method for each entity (HashMap sample example)
Method 2: Use H2 in memory using JPA, (simple to use but need to practice more)
Create 3 DAO class, internally with the help of the JPA class we can get all CRUD methods so no need to create any methods (JPA sample example)
Step 4: Create a service class for each entity and start implementing the requirement (service classes)
UserService:
createUser(username)
attendContest(contest id or contest object, username)
leaderBoard()
withdrawContest(contest id or contest object, username)QuestionService:
createQuestion(question)
listAllQuestion()ContestService:
createContest(contestId or contest object, username)
listAllContest()
runContest(contestid or contest object, username)
contestHistory()add logic for above methods plus entity validation

Step 5: Refactor code : extract class to an Interface, Abstract class, add enum, add exceptions, add constant, read from config
List<Contest> contests --(A) become --> Map<Long, List<Long>> userContestQuestions = new HashMap<>(); KEY : Contest Id, Value: list of question ids
If we do Step-1 and Step-2 correctly then finally we can see entities tables (these tables are only visible in case of JPA but this entity relationships are also valid if we are using HashMap)
Contest entity

Question entity

User entity

Other LLD example:
Problem statement (time given ~6 to 8hr): https://www.geektrust.com/challenge/my-money
My solution : https://github.com/hocyadav/geektrust_lld_mymoney