@@ -0,0 +1,1500 @@
+import java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Stack;%0A%0A// https://www.hackerrank.com/challenges/balanced-brackets/problem%0Apublic class BalancedBrackets %7B%0A%0A  private static final String NO = %22NO%22;%0A  private static final String YES = %22YES%22;%0A%0A  private static final Map%3CCharacter, Character%3E brackets;%0A  static %7B%0A    brackets = new HashMap%3C%3E();%0A    brackets.put('%7D', '%7B');%0A    brackets.put(')', '(');%0A    brackets.put('%5D', '%5B');%0A  %7D%0A%0A  private static String isBalanced(String string) %7B%0A    if (string.length() %25 2 != 0) %7B%0A      return NO;%0A    %7D%0A    Stack%3CCharacter%3E stack = new Stack%3C%3E();%0A    for (char c : string.toCharArray()) %7B%0A      Character openingChar = brackets.getOrDefault(c, null);%0A      boolean isOpeningChar = openingChar == null;%0A      if (isOpeningChar) %7B%0A        stack.push(c);%0A      %7D else %7B%0A        if (!stack.empty() && stack.peek() == openingChar) %7B%0A          stack.pop();%0A        %7D else %7B%0A          return NO;%0A        %7D%0A      %7D%0A    %7D%0A    String answer = (stack.empty()) ? YES : NO;%0A    return answer;%0A  %7D%0A%0A  public static void main(String%5B%5D args) throws IOException %7B%0A    try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) %7B%0A      int testCases = Integer.parseInt(reader.readLine());%0A      for (int i = 0; i %3C testCases; i++) %7B%0A        String string = reader.readLine();%0A        System.out.println(isBalanced(string));%0A      %7D%0A    %7D%0A  %7D%0A%7D%0A

Add solution to the Balanced brackets problem.