PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

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.

  • medium
  • NVIDIA
  • Coding & Algorithms
  • Software Engineer

Solve small string and API tasks

Company: NVIDIA

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given three small programming tasks (typical “easy” difficulty). Implement each as a function. ## 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…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…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 form: ```json [ {"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: 1. Calls the endpoint. 2. Parses the JSON. 3. Produces a summary per `group` with: - `count` of records - `totalAmount` (sum of `amount`) 4. Returns the summary list sorted by `group` ascending. **Constraints/notes:** - Records may be empty. - `amount` is a non-negative integer. - You may assume the response fits in memory (≤ `1e5` records). - Focus on correctness and clean error handling (HTTP errors, invalid JSON).

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

Return whether brackets are balanced and correctly nested.

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

  1. Use a stack of expected opening brackets.

Longest Substring Without Repeating Characters

Return the length of the longest substring with all distinct 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

  1. Track the most recent index of each character and the left edge of the window.

Summarize GET API Records by Group

Given parsed API records, return per-group count and totalAmount sorted 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

  1. The live API call is excluded from this deterministic console; aggregate the parsed records.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Compute the Final Robot Score - NVIDIA (easy)
  • Return all file paths via DFS - NVIDIA (easy)
  • Implement a disk space manager with eviction - NVIDIA (medium)
  • Implement short algorithms on logs, grids, and strings - NVIDIA (hard)
  • Implement encode/decode for list of strings - NVIDIA (easy)