Minimum Parenthesis Removals and Their Indices
Updated
Problem statement
Given a string containing only ( and ), match each closing parenthesis with the most recent unmatched opening parenthesis. Return every index left unmatched by that scan.
- The returned indices must be in ascending order.
- The array length is the minimum possible number of deletions.
Function
minimumRemovalIndices(s: String) → int[]Examples
Example 1
s = "())(()"return = [2,3]Index 2 is an unmatched closing parenthesis and index 3 is the unmatched opening parenthesis left after the scan.
Example 2
s = "))(("return = [0,1,2,3]Every parenthesis is unmatched.
Constraints
scontains only(and).
More DoorDash Onsite Interview questions
- Random Dasher Set OperationsONSITE INTERVIEW · Seen Nov 2026
- Customer Bootstrap APIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Simulate an Idempotent Refund Service FlowONSITE INTERVIEW · Seen Sep 2026
- First Unique ID in a StreamONSITE INTERVIEW · Seen Aug 2026
- Minimum Processing Speed with Multiple RidersONSITE INTERVIEW · Seen Aug 2026
- Minimum Single-Rider Processing SpeedONSITE INTERVIEW · Seen Aug 2026
- Restaurant Delivery HeatmapONSITE INTERVIEW · Seen Mar 2026
- Task Order With PrerequisitesPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2025
- All Distinct Palindromic SubstringsONSITE INTERVIEW · Seen Mar 2025
- Bellman-Ford Route Costs With CreditsONSITE INTERVIEW · Seen Sep 2024
Similar questions at other companies
- Valid ParenthesesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Valid ParenthesesEPAM · ONSITE INTERVIEWEPAM interview questions
- Valid ParenthesesQualys · ONSITE INTERVIEWQualys interview questions
- Rich Text Parser Part 1 (Validate Tokens)Figma · PHONE SCREEN · ONSITE INTERVIEWFigma interview questions
- Valid ParenthesesAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Valid ParenthesesKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
- Valid ParenthesesSalesforce · ONSITE INTERVIEWSalesforce interview questions
- Valid ParenthesesBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
- Maximum Parenthesis Nesting DepthRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
- Valid ParenthesesZillow · PHONE SCREEN · ONSITE INTERVIEWZillow interview questions
DoorDash interview experiences
- DoorDash SWE Onsite: Donation System Design: 1 Experience
- DoorDash SWE Phone Screen: Bootstrap API in Java: 1 Experience
- DoorDash SWE Virtual Onsite: 1 Experience
- DoorDash SWE Phone Screen: Bootstrap API Parsing: 1 Experience
- DoorDash Senior SWE Onsite Interview Experience: 1 Experience
- DoorDash AI CodeCraft Interview: 8 Experiences