There are x lions, y tigers, z leopards, and w panthers. Find the number of ways to place them on a line such that no two same animals are adjacent to each other. (0<=x,y,z,w<=51)
I didn't get this during the test, but can this be solved using backtracking?