PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Gofundme

Validate a bracket string

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to reason about paired-token matching and nested structure correctness in strings, measuring skills in parsing, correctness reasoning, and edge-case handling.

  • easy
  • Gofundme
  • Coding & Algorithms
  • Software Engineer

Validate a bracket string

Company: Gofundme

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

## Problem Given a string `s` consisting only of the characters `(`, `)`, `[`, `]`, `{`, `}`, determine whether the string is **valid**. A string is valid if: 1. Every opening bracket has a corresponding closing bracket of the **same type**. 2. Brackets are closed in the **correct order** (proper nesting). 3. Every closing bracket matches the most recent unmatched opening bracket. ### Input - A string `s` (length `0` to `100,000`). - `s` contains only bracket characters. ### Output - Return `true` if `s` is valid; otherwise return `false`. ### Examples - `"()[]{}"` → `true` - `"([{}])"` → `true` - `"(]"` → `false` - `"([)]"` → `false` - `"(("` → `false`

Quick Answer: This question evaluates a candidate's ability to reason about paired-token matching and nested structure correctness in strings, measuring skills in parsing, correctness reasoning, and edge-case handling.

Gofundme logo
Gofundme
Jan 19, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0
Loading...

Problem

Given a string s consisting only of the characters (, ), [, ], {, }, determine whether the string is valid.

A string is valid if:

  1. Every opening bracket has a corresponding closing bracket of the same type .
  2. Brackets are closed in the correct order (proper nesting).
  3. Every closing bracket matches the most recent unmatched opening bracket.

Input

  • A string s (length 0 to 100,000 ).
  • s contains only bracket characters.

Output

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

Examples

  • "()[]{}" → true
  • "([{}])" → true
  • "(]" → false
  • "([)]" → false
  • "((" → false

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Gofundme•More Software Engineer•Gofundme Software Engineer•Gofundme Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.