PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This collection evaluates proficiency with fundamental data structures and algorithmic techniques — including matrix and graph traversal, hash-based sets for O(1) operations, linked list manipulation, sliding-window strategies, recursive processing of nested structures, and stack/string handling — along with complexity analysis and reliable implementation. Commonly asked in the Coding & Algorithms domain, these problems assess pattern recognition, algorithmic reasoning, and practical implementation skills under time and space constraints, emphasizing applied problem-solving over purely theoretical concepts.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Solve diverse LeetCode algorithm problems

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

##### Question LeetCode 695. Max Area of Island LeetCode 380. Insert Delete GetRandom O( 1) LeetCode 19. Remove Nth Node From End of List LeetCode 1004. Max Consecutive Ones III LeetCode 339. Nested List Weight Sum LeetCode 1249. Minimum Remove to Make Valid Parentheses https://leetcode.com/problems/max-area-of-island/description/ https://leetcode.com/problems/insert-delete-getrandom-o1/description/ https://leetcode.com/problems/remove-nth-node-from-end-of-list/description/ https://leetcode.com/problems/max-consecutive-ones-iii/description/ https://leetcode.com/problems/nested-list-weight-sum/description/ https://leetcode.com/problems/minimum-remove-to-make-valid-parentheses/description/

Quick Answer: This collection evaluates proficiency with fundamental data structures and algorithmic techniques — including matrix and graph traversal, hash-based sets for O(1) operations, linked list manipulation, sliding-window strategies, recursive processing of nested structures, and stack/string handling — along with complexity analysis and reliable implementation. Commonly asked in the Coding & Algorithms domain, these problems assess pattern recognition, algorithmic reasoning, and practical implementation skills under time and space constraints, emphasizing applied problem-solving over purely theoretical concepts.

Given a string s containing only lowercase English letters and the characters '(' and ')', delete the minimum number of parentheses so the resulting string is a valid parentheses string. A string is valid if, when considering only parentheses, at no point does the number of ')' exceed the number of '(', and the total counts of '(' and ')' are equal. Return the unique string produced by removing every ')' that is unmatched during a single left-to-right scan, then removing any remaining unmatched '(' from right to left. Letters must retain their original relative order.

Constraints

  • 1 <= len(s) <= 100000
  • s consists of lowercase English letters and parentheses '(' and ')'
  • Return the unique string produced by deleting all unmatched ')' (found during a left-to-right scan) and then deleting any remaining unmatched '(' (from right to left)
  • Expected time complexity O(n) and space complexity O(n)

Examples

Input: lee(t(c)o)de)

Expected Output: lee(t(c)o)de

Input: a)b(c)d

Expected Output: ab(c)d

Input: ))((

Expected Output:

Input: (ab(c)d

Expected Output: ab(c)d

Input: a(b))c)d(

Expected Output: a(b)cd

Input: abc)def(

Expected Output: abcdef

Hints

  1. Track indices of '(' using a stack.
  2. When you see ')', if the stack is empty mark this index for removal, otherwise pop a '(' index.
  3. After scanning, any indices left in the stack are unmatched '(' and should be removed.
  4. Build the answer by skipping all marked indices.
Last updated: Mar 29, 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
  • AI Coding 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)