Must Have
Should Have
Could Have
Must Have
Should Have
Get Problem List
Endpoint: GET /api/v1/problems
Description: Fetches a list of problems.
Request:
Query params (optional): difficulty, tags
Response:
[
{
"problemId": "p1",
"title": "Two Sum",
"difficulty": "easy",
"tags": ["array", "hashmap"]
},
{
"problemId": "p2",
"title": "Longest Substring Without Repeating Characters",
"difficulty": "medium",
"tags": ["string", "sliding-window"]
}
]
Get Problem Details
Endpoint: GET /api/v1/problems/{problemId}
Description: Fetches the details of a specific problem.
Request: None
Response:
{
"problemId": "p1",
"title": "Two Sum",
"description": "Given an array of integers, return indices of the two numbers such that they add up to a specific target...",
"inputFormat": "Array of integers, Target integer",
"outputFormat": "Array of two integers (indices)",
"sampleInput": "[2, 7, 11, 15], 9",
"sampleOutput": "[0, 1]",
"constraints": "Each input has exactly one solution."
}
Create Contest
Endpoint: POST /api/v1/contests
Description: Create a new contest.
Request:
{
"name": "Monthly Code Challenge",
"startTime": "2024-09-23T10:00:00Z",
"endTime": "2024-09-23T14:00:00Z",
"problems": ["p1", "p2", "p3"]
}
Response:
{
"message": "Contest created successfully.",
"contestId": "c123"
}
Get Contest Details
Endpoint: GET /api/v1/contests/{contestId}
Description: Fetch details of a specific contest.
Response:
{
"contestId": "c123",
"name": "Monthly Code Challenge",
"startTime": "2024-09-23T10:00:00Z",
"endTime": "2024-09-23T14:00:00Z",
"problems": [
{
"problemId": "p1",
"title": "Two Sum",
"difficulty": "easy"
},
{
"problemId": "p2",
"title": "Longest Substring Without Repeating Characters",
"difficulty": "medium"
}
]
}
Get Contest Leaderboard
Endpoint: GET /api/v1/contests/{contestId}/leaderboard
Description: Fetch the leaderboard for a contest.
Response:
[
{
"userId": "user123",
"username": "coder123",
"score": 450,
"rank": 1
},
{
"userId": "user456",
"username": "codeMaster",
"score": 400,
"rank": 2
}
]
GET /problems, GET /leaderboard).user_id, contest_id, and problem_id to ensure fast lookups for leaderboards, submissions, and problem listings.submissions and leaderboard by contest or time ranges to manage large datasets efficiently.Flow Steps:
POST /api/v1/submissions with the user’s code and problem ID.Flow Steps:
/api/v1/contests/{contestId}/leaderboard).Description: The Code Execution Engine is responsible for securely executing user-submitted code in an isolated environment, evaluating it against predefined test cases, and returning the result.
Key Features:
Description: The Leaderboard Service calculates and maintains real-time rankings during a contest. It updates user scores based on their submission performance and returns sorted ranking information.
Key Features:
Description: The Submission Service manages the submission lifecycle, including queuing, processing, and storing submissions. It interacts with both the Code Execution Engine and the Leaderboard Service.
Key Features: