Spring Hire Sale
Limited Time Deal: Unlock all premium questions for over 30% off
$10.42$7.08
08
:
04
:
44
:
17
Back to Dashboard
Remove Consecutive for Balance
Medium
You are given a list of track lengths tracks and a positive integer k. Remove exactly k consecutive tracks from the list so that the sum of track lengths at even indices equals the sum at odd indices in the resulting list. Return the smallest valid starting index of the removed segment, or -1 if no such removal exists.
Indices are 0-based. The "even index sum" and "odd index sum" are computed on the resulting array after removal. ...