FastPrepValid Parentheses
Problems/Valid Parentheses

Valid Parentheses

BAMTECH Media logoBAMTECH Media● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report calls the second live-screen task validate parenthesis. The original alphabet and bounds are absent. For this exercise the alphabet is (), [] and {}, empty input is valid, nesting and types must match, and length is at most 4000. About 80% of the reported task scope is represented, as an editorial estimate rather than original-code similarity.

Return whether a string of brackets is balanced. Each closing bracket must match the type of the most recent unmatched opening bracket, and every opening bracket must eventually close.

The supported bracket types are (), [] and {}. The empty string is balanced.

Function

isValid(s: String) → boolean

Examples

Example 1

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

Each close matches the most recent opening, so the complete string is balanced.

Example 2

s = "(]"return = false

The closing square bracket does not match the opening parenthesis.

Constraints

  • 0 <= s.length <= 4000
  • s contains only ()[]{}.

More BAMTECH Media Phone Screen questions

  • Climbing StairsPHONE SCREEN · Seen Oct 2019
  • Combination SumPHONE SCREEN · Seen Oct 2019
  • Top K Largest Values with Constant Auxiliary SpacePHONE SCREEN · Seen Sep 2019

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 SequenceTripAdvisor · PHONE SCREEN
  • Rich Text Parser Part 1 (Validate Tokens)Figma · PHONE SCREEN · ONSITE INTERVIEWFigma interview questions
  • Valid ParenthesesOracle · PHONE SCREENOracle interview questions
  • Valid ParenthesesAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Balanced Bracket String CheckRippling · PHONE SCREENRippling interview questions
  • Valid Bracket SequenceNVIDIA · OA · PHONE SCREENNVIDIA interview questions
  • Valid ParenthesesBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions

Interview reports that mention this question

  • BAMTECH SWE and Data Engineer: 2 Experiences (Part 16 of 18)
See BAMTECH Media hiring insights
Saved
class Solution {
    public boolean isValid(String s) {
        // Write your code here
    }
}
Checking account…