Description
Given an integer array nums and an integer k, return true if nums has a continuous subarray of size at least 2 that sums to a multiple of k.
Examples
Input:
nums = [23,2,4,6,7], k = 6Output:
trueExplanation:
[2,4] sums to 6.
Input:
nums = [23,2,6,4,7], k = 6Output:
trueExplanation:
For nums = [23,2,6,4,7], k = 6, the answer is true because the continuous subarray sum condition is satisfied.
Input:
nums = [5,0,0], k = 3Output:
trueExplanation:
The subarray [0,0] has a sum of 0, which is a multiple of 3 (0 = 3 × 0). This demonstrates that zero is considered a multiple of any non-zero integer.
Constraints
- •
1 ≤ nums.length ≤ 10⁵