Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Continuous Subarray Sum
Bookmark
Brute Force
Prefix Sum + Hash Map
Input
Classic
Full Array
No Match
Two Zeros
Custom
nums
=
[23, 2, 4, 6, 7]
,
k
=
6
k =
6
found =
false
0
1
2
3
4
23
2
4
6
7
k =
6
found =
false
0
1
2
3
4
23
2
4
6
7
k =
6
found =
false
0
1
2
3
4
23
2
4
6
7
start
end
sum
25
mod
6
=
1
k =
6
found =
false
0
1
2
3
4
23
2
4
6
7
start
end
sum
29
mod
6
=
5
k =
6
found =
false
0
1
2
3
4
23
2
4
6
7
start
end
sum
35
mod
6
=
5
k =
6
found =
true
0
1
2
3
4
23
2
4
6
7
start
end
sum
42
mod
6
=
0
multiple of k
k =
6
found =
true
0
1
2
3
4
23
2
4
6
7
start
end
true
: nums[0..4] =
42
is a multiple of 6
algo
master
.
io
Step:
Start: find a subarray of length >= 2 whose sum is a multiple of k
0 / 5
Input
Classic
Full Array
No Match
Two Zeros
Custom
nums
=
[23, 2, 4, 6, 7]
,
k
=
6
0 / 5
algo
master
.
io
Step:
Start: find a subarray of length >= 2 whose sum is a multiple of k