Leetcode 2279 Solution
This article provides solution to leetcode question 2279 (maximum-split-of-positive-even-integers)
Access this page by simply typing in "lcs 2279" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/maximum-split-of-positive-even-integers
Solution
class Solution:
def maximumEvenSplit(self, finalSum: int) -> List[int]:
if finalSum % 2 == 1:
return []
curr = 2
ans = []
while 2 * curr < finalSum and finalSum > 0:
ans.append(curr)
finalSum -= curr
curr += 2
ans.append(finalSum)
return ans