This types of questions are always on demand like java program to find missing number from an array, specially in product based companies. Interviews are totally different between product based company and service based company.
In product based company interviewer want to evaluate not only technical part, but also they want to evaluate your logical analysis power, by asking different puzzles or logical problems.
In our previous post we have seen 10 basic core java interview questionshere. And in this post we will show you a very simple program to balanced the parenthesis, of course there are lot of ways to solve this and we are using one of the popular data structure Last-In-First-Out(LIFO) STACK implementation.
The performance of the program is in o(n).