FastPrepValid Parentheses
Problems/Valid Parentheses

Valid Parentheses

ByteDance logoByteDance● EasyFULLTIMEINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report names this well-known problem directly, but it gives no function signature, examples or limits. Our version is about 95% the same as the reported question.

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

A string is valid when every opening bracket is closed by the same type of bracket and brackets close in the reverse order in which they were opened. The empty string is valid.

Return true if s is valid; otherwise, return false.

Function

isValidParentheses(s: String) → boolean

Examples

Example 1

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

Each opening bracket is immediately followed by its matching closing bracket.

Example 2

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

The brackets are properly nested and close in reverse opening order.

Example 3

s = "([)]"return = false

The closing parenthesis appears before the nested square bracket is closed.

Constraints

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

More ByteDance Phone Screen questions

  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Implement QuicksortPHONE SCREEN · Seen Dec 2026
  • Largest Rectangle in HistogramPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Reverse Linked ListPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Count N-Queens PlacementsPHONE SCREEN · Seen Nov 2026
  • Matrix EscapePHONE SCREEN · Seen Nov 2026
  • Largest Number Below N from Reusable DigitsPHONE SCREEN · Seen Nov 2026
  • Log Analyzer: Busiest Service in a Rolling WindowPHONE SCREEN · Seen Nov 2026
  • Majority ElementPHONE SCREEN · Seen Nov 2026
  • Binary Tree Target-Sum PathsPHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • 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
  • Valid ParenthesesPeopleStrong · PHONE SCREENPeopleStrong interview questions

Interview reports that mention this question

  • ByteDance Security SRE Intern Phone Screens: 1 Experience

ByteDance interview experiences

  • ByteDance TikTok USDS SWE Intern Interview: 1 Experience
  • ByteDance MLE New Grad Interviews: 1 Experience
  • ByteDance USDS New Grad SWE Phone Screen: 1 Experience
  • ByteDance New Grad Data Engineer Video Interviews: 1 Experience
  • ByteDance Trust & Safety Research Scientist Intern: 1 Experience
All ByteDance interview questionsSee ByteDance hiring insights
Saved
class Solution {
    public boolean isValidParentheses(String s) {
        // write your code here
    }
}
Checking account…