 New update is available. Click here to update. Close
Topic list
Number of squareful arrays
HARD
50 mins 9 upvotes
Bit Manipulation
Dynamic Programming
Graph
Topics (Covered in this problem)
Problem solved
Skill meter Graph
-
- Dynamic Programming
-
- Bit Manipulation
-
-
Other topics
Problem solved
Skill meter Strings
-
- Matrices (2D Arrays)
-
- -
- Sorting
-
- Binary Search
-
- Stacks & Queues
-
- Trees
-
- Greedy
-
- Tries
-
- Arrays
-
- SQL
-
- Binary Search Trees
-
- Heap
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Number of squareful arrays

Hard 0/120
Avg time to solve 50 mins
Success Rate 50 % Share 9 upvotes

## Problem Statement

#### Example

``````ARR[1,3,6] is a Squareful array as 1+3=4 i.e. 2^2 , 3+6=9 i.e. 3^2.
``````

#### Example:

``````[1,6,3] and [6,1,3] are different permutations.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images ) ##### Sample input 1
``````3
1 24 3
``````
##### Sample output 1
``````2
``````
##### Sample input explanation
``````Different permutations of [1, 24, 3] are - [1, 24, 3] , [1, 3, 24] , [24, 1, 3] , [24, 3, 1] , [3, 1, 24] , [3, 24, 1].

Out of which [24, 1, 3] (24 + 1 = 25, 1 + 3 = 4) and [3, 1, 24] (3 + 1 = 4, 1 + 14 = 25) are Squareful.
``````
##### Sample input 2
``````4
1 1 1 1
``````
##### Sample output 2:-
``````0
``````  Auto Console