-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhard_tasks.json
More file actions
46 lines (46 loc) · 1.46 KB
/
hard_tasks.json
File metadata and controls
46 lines (46 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
"tasks": [
{
"id": "recursive-flatten",
"description": "Flatten deeply nested arrays into single array",
"examples": [
{"input": [[1,[2,[3,4]]],5], "expected_output": [1,2,3,4,5]},
{"input": [[[1]],[[2]]], "expected_output": [1,2]}
]
},
{
"id": "pivot-table",
"description": "Transform array of {key,value} into object",
"examples": [
{"input": [{"k":"a","v":1},{"k":"b","v":2}], "expected_output": {"a":1,"b":2}},
{"input": [{"k":"x","v":10}], "expected_output": {"x":10}}
]
},
{
"id": "nested-sum",
"description": "Sum all numbers in nested structure recursively",
"examples": [
{"input": {"a":1,"b":{"c":2,"d":{"e":3}}}, "expected_output": 6},
{"input": {"x":[1,2,{"y":3}]}, "expected_output": 6}
]
},
{
"id": "conditional-transform",
"description": "Double numbers if positive, zero if negative",
"examples": [
{"input": [1,-2,3,-4,5], "expected_output": [2,0,6,0,10]},
{"input": [-1,-1,2], "expected_output": [0,0,4]}
]
},
{
"id": "join-arrays",
"description": "Join two arrays by matching id field",
"examples": [
{
"input": {"users":[{"id":1,"name":"a"},{"id":2,"name":"b"}],"scores":[{"id":1,"score":100},{"id":2,"score":200}]},
"expected_output": [{"id":1,"name":"a","score":100},{"id":2,"name":"b","score":200}]
}
]
}
]
}