import java.util.*; public class PermutationSeating3 { static int count; public static void main (String[] argv) { // Test case 1. int numSeats = 3; int numPeople = 2; int[] seats = new int [numSeats]; count = 0; printPermutations (numSeats, numPeople, seats, 1); System.out.println (" => " + count + " permutations"); // Test case 2. numSeats = 5; numPeople = 2; seats = new int [numSeats]; count = 0; printPermutations (numSeats, numPeople, seats, 1); System.out.println (" => " + count + " permutations"); } static void printPermutations (int numSpaces, int numRemaining, int[] seats, int person) { if (numRemaining == 0) { System.out.println ( Arrays.toString(seats) ); count ++; return; } // Look for an empty spot. for (int i=0; i