Dsa
Math
Easy
Minimum Squareful Array Count
Given a list of integers, count how many unique arrangements (permutations) of the array exist such that the sum of every adjacent pair is a perfect square.
Input Format:
- The first line contains an integer N (1 <= N <= 10), the size of the list.
- The second line contains N space-separated integers (1 <= each integer <= 100).
Output Format:
- Print a single integer representing the count of unique squareful arrangements.
Example:
Input:
3
1 8 9
Output:
1
(Explanation: The only valid arrangement is [1, 8, 9] since 1+8=9 (perfect square)).
Key concepts
matharrayscounting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now