Solve small string and API tasks
Task 1: Validate Parentheses
Given a string s consisting only of the characters '(' , ')' , '{' , '}' , '[' , ']', determine whether it is valid.
A string is valid if:
- Open brackets are closed by the same type of brackets.
- Open brackets are closed in the correct order.
- Every close bracket has a corresponding open bracket.
Input: s (length 0 to 1e5)
Output: true if valid, else false
Task 2: Longest Substring Without Repeating Characters
Given a string s (ASCII), return the length of the longest substring that contains no repeated characters.
Input: s (length 0 to 2e5)
Output: Integer length
Task 3: Fetch from a Public GET API and Transform
You are given a public HTTP GET endpoint that returns JSON. Assume the endpoint returns an array of records in the following 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 performs the following steps:
- Calls the endpoint.
- Parses the JSON response.
- Produces a summary per
groupwith:countof recordstotalAmount(sum ofamount)
- Returns the summary list sorted by
groupascending.
Constraints/Notes:
- Records may be empty.
amountis a non-negative integer.- You may assume the response fits in memory (up to
1e5records). - Focus on correctness and clean error handling (HTTP errors, invalid JSON).
AI interview prep
Core dilemma
The central dilemma is demonstrating robust, production-ready code across diverse fundamental software engineering domains (algorithms, data structures, API interaction, error handling) under time pressure. For the API task specifically, it's about balancing efficient in-memory data processing with comprehensive error handling for external dependencies.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Solve small string and API tasks
Task 1: Validate Parentheses
Given a string s consisting only of the characters '(' , ')' , '{' , '}' , '[' , ']', determine whether it is valid.
A string is valid if:
- Open brackets are closed by the same type of brackets.
- Open brackets are closed in the correct order.
- Every close bracket has a corresponding open bracket.
Input: s (length 0 to 1e5)
Output: true if valid, else false
Task 2: Longest Substring Without Repeating Characters
Given a string s (ASCII), return the length of the longest substring that contains no repeated characters.
Input: s (length 0 to 2e5)
Output: Integer length
Task 3: Fetch from a Public GET API and Transform
You are given a public HTTP GET endpoint that returns JSON. Assume the endpoint returns an array of records in the following 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 performs the following steps:
- Calls the endpoint.
- Parses the JSON response.
- Produces a summary per
groupwith:countof recordstotalAmount(sum ofamount)
- Returns the summary list sorted by
groupascending.
Constraints/Notes:
- Records may be empty.
amountis a non-negative integer.- You may assume the response fits in memory (up to
1e5records). - Focus on correctness and clean error handling (HTTP errors, invalid JSON).