Challenge: Maximum Number of Prizes

Solve the Distinct Summands Problem.

We'll cover the following

Problem


Distinct Summands Problem

Represent a positive integer as the sum of the maximum number of pairwise distinct positive integers.

Input: An integer nn.
Output: The maximum kk such that nn can be represented as the sum a1a_{1} +++ \ldots + aka_{k} of kk distinct integers.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.