View All num of num See all Photos Ooyala www.ooyala.com Engaged Employer Overview Reviews Salaries Interviews Jobs Photos Benefits 54 Reviews 77 Salaries 51 Interviews Follow Add Review or Salary Follow Add Review or Salary Interview Question Software Engineer Interview San Jose, CA Ooyala given a string,which is filled with either "(" or ")", for example "(())()())", write a function to check if the string is "proper". A "proper" string means if there is a "(" in the string, there should be a ")" which corresponds to the "(" in the string. For example, "))()(" Tags: c++ programming See more , See less 8 Answer Add Tags Answer Interview Answer 3 Answers ▲ 0 ▼ two sub tasks. One is to check if the number of "(" and ")" in the entire string are equal. The other task is to check the number of "(" is always no less than the number of ")" when traversal the string from the head of string to the end. Interview Candidate on Dec 16, 2010 ▲ 3 ▼ you can traverse through the string in a loop and increment a counter on occurrence of '(' and decrement on occurrence of ')' .Return false if counter becomes negative anytime in the loop. noty on Mar 28, 2011 ▲ 0 ▼ Just a single stack, pop for ')' and push for '('. if isEmpty() when you encounter ')' means string is not proper Anonymous on Dec 24, 2013 Interviews > Software Engineer > Ooyala Add Answers or Comments To comment on this, Sign In or Sign Up.