Skip to content

Commit

Permalink
akshitagit#46 - additional cases
Browse files Browse the repository at this point in the history
clean up spacing
  • Loading branch information
Nowele committed Sep 26, 2020
1 parent a148bd2 commit b4c07c8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Interview_Questions/BalanceParentheses.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class BalanceParentheses {

public static void balanceParentheses(String brackets) {

//Characters
// Characters
String curlyOpen = "{";
String curlyClose = "}";
String bracketOpen = "[";
Expand All @@ -35,16 +35,19 @@ public static void balanceParentheses(String brackets) {

String result = "";

//@TODO - determine if brackets is balanced
// @TODO - determine if brackets is balanced

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

public static void main(String[] args) {
balanceParentheses("(())"); //balanced
balanceParentheses("(())()"); //balanced
balanceParentheses("())("); // not balanced
balanceParentheses("(()))"); //not balanced
balanceParentheses("(())"); // Yes
balanceParentheses("(())"); // Yes
balanceParentheses("(())()"); // Yes
balanceParentheses("())("); // No
balanceParentheses("(()))"); // No
balanceParentheses("[()]{}{[()()]()}"); // Yes
balanceParentheses("{[(])"); // No

}

Expand Down

0 comments on commit b4c07c8

Please sign in to comment.