Equal split point
Two teammates agree to split a chronological list of project expenses: the first pays every expense up to some cut point, the second pays everything after it. Both parts must be non-empty and must total the same amount. Given the expense amounts in order (values may be negative for refunds), return True if such a cut point exists and False otherwise. Example: costs = [10, 4, 6, 8, 12] gives True — cut after the third expense: 10 + 4 + 6 = 8 + 12 = 20.
Implement
can_split_evenly(costs: list[int]) → boolExamples
in
[[10,4,6,8,12]]outtrueWhat a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 11 min
solution.py
InputExpectedGot
[[10,4,6,8,12]]truenot run yetsample