Your question is Remove Invalid Parentheses. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Remove the minimum number of invalid parentheses from a string and return all valid results.
Asked in the Coding stage. Algorithmic coding task focused on search space and string manipulation.
Write a PostgreSQL query that reads candidate Instagram Reels captions from a table and returns every caption that is valid after removing the minimum number of parentheses.
( and ) as parentheses, all other characters are literal text.removed_count ascending, then valid_caption ascending.| Column | Type | Description |
|---|---|---|
| candidate_idPK | INT | Unique identifier for the caption candidate |
| caption_text | TEXT | Instagram Reels caption text to validate |