Medium · Math

Maximum Split of Positive Even Integers

Given an integer finalSum, 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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Math problems