Skip to main content
2 of 3
deleted 15 characters in body
G B
  • 22.8k
  • 1
  • 20
  • 53

Ruby, 76 bytes

f=->n,r=[[]]{r.find{|q|q.sum==n}||f[n,r.product([*1..n]).map{|x,y|x+[y*y]}]}

Try it online!

G B
  • 22.8k
  • 1
  • 20
  • 53