New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
JobRadar
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Coding Question
Hack2hire 50 Picks
AI Insights
Quick Summary
Remove exactly k consecutive elements from an array to balance the sum of values at even and odd indices.
The resulting array must satisfy sum(even_indices) == sum(odd_indices).
Return the smallest starting index of the removed window, or -1 if impossible.
What This Tests
Efficiently evaluating sliding windows using prefix sums.
Handling index parity shifts when subarrays are removed.
Mathematical reasoning regarding cumulative sums and constraints.
Common Patterns
Prefix Sum
Sliding Window
Math
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Accepted
1.8k
/3.4k
Acceptance Rate
54.2%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
nums =
k =
Output
Expected