Interview Question for Android Engineers


Country: United States
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
4
of 4 vote

How would you know where the missing parenthesis go? In your example, (a(b(c)de)) is also a valid answer.

If the parenthesis can go anywhere just count the number of "open" parenthesis that don't have a closing parenthesis and add them all at the end.

- Anonymous June 27, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use Stack to process this expression.

- Anonymous June 28, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Technically, the question never states that the string to be returned should be a function of the string taken in input. So I would return the empty String (which by definition has a balanced number of parenthesys) regardless of the input

- Anonymous June 28, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It is never stated that the output string should be a function of the input. Regardless of the input, I would simply return the empty string, which is balanced by definition.

- Acerone85 June 28, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

You know what this can be an excellent question. I am not sure even interviewer thought to be that one. This actually is a palindrome question. Here is how.

The question is not to balance a parenthesis, which an be debatable coz any combination can give you balance expression.

So, how do you resolve this problem, is parse all string except braces and replace with common character. Ex. (a(b(c)de will become (x(x(x)xx.

Now, what it takes to convert this expression into palindrome is the question. I am sure may can now answer without further hints .

- hprem991 June 30, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More