2279. Maximum Split of Positive Even Integers
My accepted Python solution to LeetCode problem 2279, Maximum Split of Positive Even Integers, running in 63ms.
- Difficulty: Medium
- Python
- Runtime 63ms
- Memory 26.9MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 63ms, memory 26.9MB, accepted 2026-01-02.
class Solution:
def maximumEvenSplit(self, finalSum: int) -> List[int]:
if finalSum % 2 == 1:
return []
result = []
current = 2
remaining = finalSum
while remaining >= current:
if remaining - current > current: # Can still add more
result.append(current)
remaining -= current
current += 2
else:
# remaining will be added to result as the last element
result.append(remaining)
break
return result