You are given three small programming tasks (typical “easy” difficulty). Implement each as a function.
Given a string s consisting only of the characters '(' , ')' , '{' , '}' , '[' , ']', determine whether it is valid.
A string is valid if:
Input: s (length 0…1e5)
Output: true if valid, else false
Given a string s (ASCII), return the length of the longest substring that contains no repeated characters.
Input: s (length 0…2e5)
Output: integer length
You are given a public HTTP GET endpoint that returns JSON.
Assume the endpoint returns an array of records in the form:
[
{"id":"a1","group":"books","amount":12,"ts":"2026-01-01T10:00:00Z"},
{"id":"a2","group":"books","amount":7,"ts":"2026-01-01T11:00:00Z"},
{"id":"b1","group":"games","amount":20,"ts":"2026-01-02T09:00:00Z"}
]
Write code that:
group
with:
count
of records
totalAmount
(sum of
amount
)
group
ascending.
Constraints/notes:
amount
is a non-negative integer.
1e5
records).