Avatar ·

Decompose a number into the minimum number of squares

📁 example

Task: The user enters a number no more than 10 000 000 , the program should decompose the number into a sum of squares so that these squares are the minimum number

Example: 34 = 25+9

35 = 25+9+1

32+16

39 = 39 = 39 = 39 = 39 = 39 = 39 = 39 = 39 = 39 = 39 = 39 = 39 = 39 = 25+9+4+1

honestly, I know Python at 6+, but I can't figure out the algorithm itself, help at least with it