-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
GET and POST Request Routes
GET
GET request to /problems/1 should return the following JSON data:
{
"id": "1",
"title": "Two Sum",
"difficulty": "Easy",
"objectives": [
"Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.",
"You may assume that each input would have exactly one solution, and you may not use the same element twice.",
"You can return the answer in any order."
],
"examples": [
{
"input": "nums = [2,7,11,15], target = 9",
"output": "[0,1]",
"explanation": "Because nums[0] + nums[1] == 9, we return [0, 1]."
},
{
"input": "nums = [3,2,4], target = 6",
"output": "[1,2]"
},
{
"input": "nums = [3,3], target = 6",
"output": "[0,1]"
}
],
"starterCode": "def twoSum(nums: List[int], target: int) -> List[int]:\n\t# Code here...\n\tpass"
}POST
This how a post request (in Javascript) looks like for /problems/1/play:
fetch('/problems/1/play', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: {
'language': 'python',
'script': 'def twoSum(nums: List[int], target: int) -> List[int]:\n\t# Code here...\n\tpass'
}
});Metadata
Metadata
Assignees
Labels
No labels