Good morning, all.
This challenge finishes our second week of the Daily Challenge series. It'll be our most difficult challenge yet!
We are grateful to user g964, who posted this challenge and many others on CodeWars.
Given a positive integer
n, return a strictly increasing sequence of numbers so that the sum of the squares is equal to n².
If there are multiple solutions, return the result with the largest possible value:
Note: there are actually two ways to decompose
11², 11² = 121 = 1 + 4 + 16 + 100 = 1² + 2² + 4² + 10²but you shouldn't return
[2,6,9], since 9 is smaller than 10.
Hint: Very often will
Good luck and happy coding!
Single Responsibility Principle (or SRP) is one of the most important concepts in software development. The main idea of this concept is: all pieces of software must have only a single responsibility.