Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stacks/Assignment/MinimumBracketsReversal.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public static int countBracketsReversals(String expression) {
return -1; // Only even numbers of brackets can be balanced
}

var stack = new Stack<Character>();
Stack<Character> stack = new Stack<Character>();
for (int i = 0; i < expression.length(); i++) {
char currentCharacter = expression.charAt(i);

if (currentCharacter == '(') {
if (currentCharacter == '{') {
stack.push(currentCharacter);
} else {
// pop if there is a balanced pair
Expand Down