SHARE
TWEET

Untitled

a guest Aug 26th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. boolean regularBracketSequence1(String str) {
  2.     System.out.println(str);
  3.     if(str.length()%2 != 0){
  4.         return false;
  5.     }
  6.     if(str.length()>= 4){
  7.         System.out.println("This was ran");
  8.         for(int i=0; i<str.length()-1; ++i){
  9.             if(str.charAt(i)=='('){
  10.                 if(str.charAt(i+1)==')'){
  11.                     if(i==0){
  12.                         String recStr= str.substring(i+2, str.length());
  13.                         regularBracketSequence1(recStr);
  14.                     }
  15.                     else{
  16.                         String recStr= str.substring(0,i)+ str.substring(i+2, str.length());
  17.                         regularBracketSequence1(recStr);
  18.                     }
  19.                 }
  20.             }
  21.         }
  22.     }
  23.     if(str.equals("()")){
  24.         return true;
  25.     }
  26.     else return false;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top