PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This Coding & Algorithms problem evaluates string-processing and bracket-matching skills, specifically understanding of stack-based parsing, handling multiple bracket types, and minimizing removals while preserving non-bracket characters.

  • hard
  • Meta
  • Coding & Algorithms
  • Software Engineer

Remove minimum invalid mixed brackets

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

Given a string `s` containing letters and bracket characters from the set `()`, `[]`, `{}`, remove the minimum number of bracket characters so that the resulting string has properly matched and properly nested brackets. Rules: - Matching must respect types: `(` matches `)`, `[` matches `]`, `{` matches `}`. - Brackets must be properly nested (e.g., `([)]` is invalid). - Keep all non-bracket characters in their original order. - If multiple valid answers exist, return any one. Example: - Input: `([{ab)` - Output: `(ab)` (remove `[` and `{` to make the remaining brackets valid).

Quick Answer: This Coding & Algorithms problem evaluates string-processing and bracket-matching skills, specifically understanding of stack-based parsing, handling multiple bracket types, and minimizing removals while preserving non-bracket characters.

Remove the fewest bracket characters so the remaining brackets are properly typed and nested; letters are always kept.

Examples

Input: ('([{ab)',)

Expected Output: '(ab)'

Explanation: Prompt-style mixed invalid brackets.

Input: ('([)]',)

Expected Output: '()'

Explanation: Must remove a crossing pair.

Input: ('a{b[c]d}e',)

Expected Output: 'a{b[c]d}e'

Explanation: Already valid.

Input: ('}{abc',)

Expected Output: 'abc'

Explanation: Unmatched closers/openers.

Hints

  1. Dynamic programming can choose a maximum kept valid bracket subsequence while preserving all letters.
Last updated: Jun 27, 2026

Loading coding console...

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.

Related Coding Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)