Redirecting to

Min Squares

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

1. You are given a number N.
2. You have to find the minimum number of squares that sum to N.
3. You can always represent a number as a sum of squares of other numbers.
For eg -> In worst case N can be represented as (1*1) + (1*1) + (1*1)..... N times.
Input Format
An integer N
Output Format
Check the sample output and question video.
Question Video
1 <= N <= 10^5
Sample Input
Sample Output

  • Asked in Companies
  • Related Topics

Video Solution

Code Solution

Id Name