7. Continuous Subarray Sum
Given an integer array nums
and an integer k
, return true
if nums
has a continuous subarray of size at least two whose elements sum up to a multiple of k
, or false
otherwise.
An integer x
is a multiple of k
if there exists an integer n
such that x = n * k
. 0
is always a multiple of k
.
Example 1:
Example 2:
Example 3:
Solution: (Prefix Sum of Remainder)
Time Complexity: O(n)
Last updated