Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Feb 19th, 2018 46 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.    /* determine if puzzle is solvable */
  2.    public static boolean isSolvable(int[] state) {
  3.      int inversions = 0;
  4.      for (int i = 0; i < state.length; i++)
  5.        for (int j = i; j < state.length; j++)
  6.          if (state[i] < state[j]) inversions++;
  7.          
  8.      System.out.println("Inversion: " + inversions);
  9.      return true;
  10.    }
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