Skip to content

Commit

Permalink
akshitagit#46 - pseudocode
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowele committed Sep 26, 2020
1 parent b4c07c8 commit 11f20b1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Interview_Questions/BalanceParentheses.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.ArrayList;

/*
https://github.com/akshitagit/JAVA/issues/46
You are given a string of brackets i.e. '{', '}' , '(' , ')', '[' , ']' .
Expand Down Expand Up @@ -31,11 +33,22 @@ public static void balanceParentheses(String brackets) {
String bracketOpen = "[";
String bracketClose = "]";
String parenthesesOpen = "(";
String parentheseClose = ")";
String parenthesesClose = ")";

String result = "";
ArrayList<String> balanceList = new ArrayList<String>();

for (int i = 0; i <= brackets.length()-1; i++) {
// if bracket is an open character, add it to the balanceList

//if a char is a close character and it is match for the last character in the balanceList, pop the open character.

//else result = "No"
}

//if balanceList is empty, result = "Yes";

// @TODO - determine if brackets is balanced
// else, result = "No";

System.out.println("result: " + result);
}
Expand Down

0 comments on commit 11f20b1

Please sign in to comment.