leetle

Daily challenge for 2026-04-30

485. Balanced Window Sum Equality

Given an array of integers nums and an integer k, determine whether there exists a contiguous subarray of length k such that the sum of its left half equals the sum of its right half. If k is odd, ignore the middle element when computing the two sums. Return true if such a subarray exists, otherwise return false.

Example:
Input: nums = [1, 10, 1, 10, 1], k = 5
Output: true

Explanation: The only subarray of length 5 is [1, 10, 1, 10, 1]. Ignoring the middle element, the left half is [1, 10] with sum 11 and the right half is [10, 1] with sum 11, so this window satisfies the condition.

Run this challenge interactively in Python or JavaScript when the app loads.