To the Top
File:  root - text - article - 2019 - 12 - minimum-removals-for-valid-parenthesis.txt.txt
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Category: Computing | 163 Views, 15345 Search Bots | 74 Words

Subscribe to Feed Burner | Browse | Archive
Hi, here's your problem today. This problem was recently asked by Uber:

You are given a string of parenthesis. Return the minimum number of parenthesis that would need to be removed in order to make the string valid. "Valid" means that each open parenthesis has a matching closed parenthesis.

Example:

"()())()"

The following input should return 1.

")("

Here's a start:


def count_invalid_parenthesis(string):
# Fill this in.

print count_invalid_parenthesis("()())()")
# 1
Tags: 每日算法题, 算法, 数据结构, 面试题, Daily Interview Problem, Data Structures and Algorithms, Computer Programming, Python, | English | Home Page | Cateogry: Computing | 163 Views, 15345 Search Bots | 74 Words Subscribe to Feed Burner

Related Articles

  1. Staying on a Chess Board
  2. Daily Interview Problem: Product of Array Except Self
  3. Spreadsheet Column Title
  4. CVE-2015-8874 - cPanel EasyApache Vulnerabilities
  5. Find Pythagorean Triplets
  6. Daily Interview Problem: Maximum Profit From Stocks
  7. Daily Interview Problem: Reverse Words in a String
  8. Algorithm Interview Question: Symmetric k-ary Tree
  9. Algorithm Interview: Maximum Path Sum in Binary Tree
  10. Daily Interview Problem: Min Stack

Comments (0)

Your Email (Domain Part Not Exposed):

Your Comments:

Privately By Mail Colors More Smileys S x y @

Verification (Click Image 2 Refresh):

    Be the first one to comment this page !


Page Edited: October 30 2020 14:21:09 | RSS Subscription
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />