Solve small string and API tasks
Company: NVIDIA
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Quick Answer: This question evaluates proficiency in string algorithms (bracket validation and longest non-repeating substring) and practical API skills including HTTP request handling, JSON parsing, and data aggregation.
Validate Brackets
Constraints
- s contains only bracket characters
Examples
Input: ('()[]{}',)
Expected Output: True
Explanation: All bracket types.
Input: ('(]',)
Expected Output: False
Explanation: Mismatched closing bracket.
Input: ('',)
Expected Output: True
Explanation: Empty string is valid.
Input: ('{[]}',)
Expected Output: True
Explanation: Nested valid brackets.
Hints
- Use a stack of expected opening brackets.
Longest Substring Without Repeating Characters
Constraints
- s is ASCII for this problem
Examples
Input: ('abcabcbb',)
Expected Output: 3
Explanation: Classic case.
Input: ('bbbbb',)
Expected Output: 1
Explanation: All same.
Input: ('',)
Expected Output: 0
Explanation: Empty string.
Input: ('pwwkew',)
Expected Output: 3
Explanation: Window jumps past repeated character.
Hints
- Track the most recent index of each character and the left edge of the window.
Summarize GET API Records by Group
Constraints
- records fit in memory
- amount is non-negative
Examples
Input: ([{'id': 'a1', 'group': 'books', 'amount': 12}, {'id': 'a2', 'group': 'books', 'amount': 7}, {'id': 'b1', 'group': 'games', 'amount': 20}],)
Expected Output: [{'group': 'books', 'count': 2, 'totalAmount': 19}, {'group': 'games', 'count': 1, 'totalAmount': 20}]
Explanation: Prompt example after JSON parsing.
Input: ([],)
Expected Output: []
Explanation: Empty response.
Input: ([{'group': 'x', 'amount': 0}],)
Expected Output: [{'group': 'x', 'count': 1, 'totalAmount': 0}]
Explanation: Zero amount.
Hints
- The live API call is excluded from this deterministic console; aggregate the parsed records.