Equal split point

Write codeEasy11 min

Your task

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.

Examples

can_split_evenly(costs: list[int]) -> bool
Example 1
Inputcan_split_evenly([10, 4, 6, 8, 12])
OutputTrue