Medium · Math

Maximum Split of Positive Even Integers

Given an integer finalSum in [0, 10¹⁰], split it into the largest possible number of distinct positive even integers that add up to finalSum and return them in any order, or return an empty list if no such split exists.

Examples

Example 1

finalSum = 12

Output: [2,4,6]

Example 2

finalSum = 7 (odd)

Output: [] (odd)

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Math problems