FastPrepValid Bracket Sequence
Problems/Valid Bracket Sequence

Valid Bracket Sequence

NVIDIA logoNVIDIA● EasyFULLTIMEINTERNOAPHONE SCREEN

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A NVIDIA applied-research intern report tentatively recalls a very simple OA resembling valid parentheses. The exact bracket set and rules were not reported. This practice uses the conventional three bracket pairs and a stack; it matches the reported core at about 55%.

Given a string s containing only the bracket characters ()[]{}, determine whether it is a valid bracket sequence.

Every opening bracket must be closed by the same bracket type, and closing brackets must appear in the reverse order of their matching openings. A closing bracket without a prior unmatched opening is invalid. The empty string is valid.

Function

isValidBracketSequence(s: String) → boolean

Examples

Example 1

s = "([]){}"return = true

Each closer matches the newest unmatched opener of the same type.

Example 2

s = "([)]"return = false

The closing parenthesis arrives while the square bracket is still open.

Example 3

s = "((("return = false

Three opening brackets remain unmatched.

Example 4

s = ""return = true

There are no unmatched brackets in the empty sequence.

Constraints

  • 0 <= s.length <= 100000.
  • Every character is one of (, ), [, ], {, or }.

More NVIDIA Online Assessment questions

  • Query a Header-Encoded MatrixOA · Seen Oct 2026
  • Maximum ScoreOA · Seen Oct 2026
  • Address on Same PageOA · Seen Oct 2026
  • Minimize Task Resource ConsumptionOA · Seen Oct 2026
  • Minimum Project Bid CostOA · Seen Oct 2026
  • Count Ideal Numbers in a RangeOA · Seen Oct 2026
  • Generate Bit MaskOA · Seen Oct 2026
  • Reconstruct an Array from Prefix XOROA · Seen Oct 2026
  • Sum of Subarray MinimumsOA · Seen Oct 2026
  • Unique Integers That Sum to ZeroOA · Seen Oct 2026

Similar questions at other companies

  • Valid ParenthesesByteDance · PHONE SCREENByteDance interview questions
  • Valid ParenthesesCisco · PHONE SCREENCisco interview questions
  • Stack Formula InterpreterTypeSafe AI · PHONE SCREEN
  • Validate a Bracket SequenceInMobi · OAInMobi interview questions
  • Validate a Bracket SequenceTripAdvisor · PHONE SCREEN
  • Rich Text Parser Part 1 (Validate Tokens)Figma · PHONE SCREEN · ONSITE INTERVIEWFigma interview questions
  • Valid ParenthesesBlackRock · OABlackRock interview questions
  • Valid ParenthesesOracle · PHONE SCREENOracle interview questions
  • Valid ParenthesesAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Valid ParenthesesVanguard · OAVanguard interview questions

Interview reports that mention this question

  • NVIDIA OA: What It Tests (2026)
  • NVIDIA Software Intern Interview Questions: 9 Experiences

NVIDIA interview experiences

  • NVIDIA Full-Time SWE Onsite Scheduling: 1 Experience
  • NVIDIA DevOps, QA and Infra Intern Interviews: 12 Experiences
  • NVIDIA Ignite Internship OA Experience
  • NVIDIA Ignite SWE Intern OA Questions: 6 Experiences
All NVIDIA interview questionsSee NVIDIA hiring insights
Saved
class Solution {
    public boolean isValidBracketSequence(String s) {
        // Write your code here.
    }
}
Checking account…