Search
⌘K

Leetcode 996. Number of Squareful Arrays

Count distinct permutations of nums where every adjacent pair sums to a perfect square; the core challenge is to build a graph of valid adjacencies and count Hamiltonian paths over it while handling duplicate values (typically solved with backtracking + pruning or bitmask DP/memoization for n ≤ 12).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.