β Squiggly brackets (Contest)
Squiggly brackets easy Time Limit: 2 sec Memory Limit: 128000 kB
```java
import java.io.*; // for handling input/output
import java.util.*; // contains Collections framework
// don't change the name of this class
// you can add inner classes if needed
class Main {
public static void main (String[] args) {
// Your code here
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
balance(0,0,n);
System.out.println(count);
}
static int count =0;
public static void balance(int open,int close,int n){
if(close ==n){
count++;
return;
}
if(open>close){
balance(open, close+1, n);
}
if(open<n){
balance(open+1, close, n);
}
}
}
```Last updated