Avatar ·

Decompose a number into the shortest sum of squares

📁 example

Task: the user enters a number no greater than 10,000,000, the program must decompose the number into a sum of squares so that the number of these squares is minimal.

Example: 34 = 25+9

35 = 25+9+1

32 = 16+16

39 = 25+9+4+1

Honestly, I know Python at a 6+ level, but I can't figure out the algorithm itself, at least help me with that.