FastPrepAre the Brackets Balanced
Problems/Are the Brackets Balanced

Are the Brackets Balanced

Adobe logoAdobe● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: You check whether a string of three kinds of brackets is properly balanced. A report for a contract software engineer role at Adobe in San Jose, California (June 2023, no offer) names this classic task by its usual title. It was one of the two coding questions of the interview, set up after a recruiter's contact through an outside vendor. The other was a meeting-scheduling task. It gives the title alone, with no limits or examples.

The rules are those of the named task: three bracket kinds, matching kinds and no crossing pairs. We chose these limits: strings of 1 to 10^4 bracket characters. We wrote new examples.

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

You are given a string s made of round (), square [] and curly {} brackets. Return true if the brackets are balanced, and false otherwise.

The brackets are balanced when every opening bracket is later closed by a closing bracket of the same kind, every closing bracket closes an earlier opening bracket, and pairs do not cross: a bracket opened later must be closed earlier. For example, [{}()] is balanced, while {[}] is not.

Function

isBalanced(s: String) → boolean

Examples

Example 1

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

Each opening bracket is closed by the matching kind in the right order: ( closes first, then {, then [, and the last pair () stands on its own. The answer is true.

Example 2

s = "{(})"return = false

The counts are fine (one of each kind opened and closed), but } arrives while ( is still the most recently opened bracket. Brackets may not cross, so the answer is false.

Example 3

s = "))(("return = false

The string starts with a closing bracket that has nothing to close. The answer is false.

Constraints

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

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 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
  • 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

  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe MTS Interview Questions: 12 Experiences (Part 2 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public boolean isBalanced(String s) {
        // Write your code here.
    }
}
Checking account…