-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
LearnJava/CodingJava/src/main/java/BalancedParanthesis.java
There is no need for the isContinue variable.
Return false whenever you find that the parenthesis is not matching. peek() is not required. can use pop() directly.
The return type of method1() can be changed to boolean. In cases where a closing parenthesis is encountered,
.......................
case '}':
if(!stack.isEmpty()&stack.pop()!='{'){
return false;
}
break;
.....................
return true after the switch block,
Metadata
Metadata
Assignees
Labels
No labels