daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. boolean rearrange(String[] str, String[] fixed, int curr, int next, int pos){
  2.         if(pos == str.length - 1) {
  3.             System.out.println("magic");
  4.             return true;
  5.         }
  6.  
  7.         if(curr < str.length && next < str.length){
  8.             if(curr != next && strCompare(fixed[curr], fixed[next])){
  9.                 swap(fixed, curr, next, pos);
  10.                 rearrange(str, fixed, pos + 1, pos + 2, pos + 1);
  11.         }
  12.         rearrange(str, fixed, curr + 1, next, pos);
  13.         rearrange(str, fixed, curr, next + 1, pos);
  14.     }
  15.     return false;
  16. }
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