Skip to content

Commit 02f7fbe

Browse files
committed
Adding testcase for Combinations of Brackets problem
1 parent 867f110 commit 02f7fbe

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

InterviewPrograms/src/com/hackerrank/AllCombinationsOfBrackets.java

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ public class AllCombinationsOfBrackets {
44

55
static int count = 0;
66
public static void main(String[] args) {
7-
brackets(3, 0, "");
8-
bracketsCount(3, 0, "");
9-
System.out.println(count);
7+
brackets(4, 0, "");
8+
bracketsCount(4, 0, "");
9+
System.out.println("Count is :: "+count);
1010
}
1111

1212
public static void brackets(int openStack,int closeStack, String s ){
@@ -26,4 +26,36 @@ public static void bracketsCount(int openStack,int closeStack, String s ){
2626
if( closeStack > 0)
2727
bracketsCount(openStack, closeStack-1, s+")");
2828
}
29-
}
29+
}
30+
31+
/*
32+
Input
33+
3
34+
Output
35+
((()))
36+
(()())
37+
(())()
38+
()(())
39+
()()()
40+
Count is :: 5
41+
42+
Input
43+
4
44+
Output
45+
(((())))
46+
((()()))
47+
((())())
48+
((()))()
49+
(()(()))
50+
(()()())
51+
(()())()
52+
(())(())
53+
(())()()
54+
()((()))
55+
()(()())
56+
()(())()
57+
()()(())
58+
()()()()
59+
Count is :: 14
60+
*/
61+

0 commit comments

Comments
 (0)