FastPrepBalanced Bracket String Check
Problems/Balanced Bracket String Check

Balanced Bracket String Check

Rippling logoRippling● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: We start from a review dated July 16, 2026, by a software development engineer who accepted a Rippling offer. Its coding round had two tasks: one was a first-unique-character question, and the other asked if the parentheses in a string are balanced. Only the task names are given.

The entry speaks of parentheses only. Square and curly brackets are our addition, and with three kinds one running count is no longer enough. The entry also does not say whether other characters appear or what to return. Here the string holds only round, square and curly brackets. A closing bracket must close the most recently opened bracket that is still open, and that bracket must be the same kind, so [(]) is not balanced. The answer is true or false, and the limits and examples are our own.

Our version is about 80% the same as the reported question.

You are given a string s made of three kinds of brackets: round ( ), square [ ] and curly { }.

The string is balanced when every opening bracket is closed by a closing bracket of the same kind, every closing bracket closes an earlier opening bracket, and brackets close in the reverse order they were opened, so pairs never cross. For example, [{}] is balanced but [{]} is not.

Return true if s is balanced, and false otherwise.

Function

isValid(s: String) → boolean

Examples

Example 1

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

Each closing bracket closes the most recently opened bracket that is still open, and that bracket is always the same kind. Nothing is left open at the end, so the answer is true.

Example 2

s = "[(])"return = false

Positions count from 0. The ] at position 2 arrives while the ( at position 1 is the most recently opened bracket that is still open, so the brackets cross. The answer is false, even though each kind has one opening and one closing bracket.

Example 3

s = "({}[]"return = false

The pairs {} and [] close, but the first ( is never closed. The answer is false.

Constraints

  • 1 <= s.length <= 10^4
  • s consists only of the characters (, ), [, ], { and }.

More Rippling Phone Screen questions

  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
  • Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
  • Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
  • Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Median Across N Sorted ArraysPHONE SCREEN · 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 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
  • Valid Bracket SequenceNVIDIA · OA · PHONE SCREENNVIDIA interview questions
  • Valid ParenthesesBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Valid ParenthesesPeopleStrong · PHONE SCREENPeopleStrong interview questions

Interview reports that mention this question

  • Rippling No-Level Design, Screens: 30 Experiences (Part 2 of 6)
  • Rippling SWE Interviews, No Level: 156 Experiences (Part 1 of 6)

Rippling interview experiences

  • Rippling No-Level Older Reports: 31 Experiences (Part 6 of 6)
  • Rippling No-Level Onsite Loops: 24 Experiences (Part 5 of 6)
  • Rippling No-Level Screens and Loops: 18 Experiences (Part 4 of 6)
  • Rippling No-Level Coding Screens: 37 Experiences (Part 3 of 6)
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public boolean isValid(String s) {
        // Write your code here.
    }
}
Checking account…