Given an array
nums of non-negative integers, the array is squareful if for every pair of adjacent elements, their sum is a perfect square.
Return the number of permutations of nums that are squareful. Two permutations
perm2 differ if and only if there is some index
i such that
perm1[i] != perm2[i].
Input: nums = [1,17,8] Output: 2 Explanation: [1,8,17] and [17,8,1] are the valid permutations.
Input: nums = [2,2,2] Output: 1
1 <= nums.length <= 12
0 <= nums[i] <= 109