Medium · Prefix Sum

Continuous Subarray Sum

Given an integer array nums and an integer k ≥ 1, return true if some contiguous subarray of length at least 2 has a sum that is a multiple of k (0 counts as a multiple), and false otherwise.

Examples

Example 1

[23,2,4,6,7], k=6

Output: true

Example 2

[23,2,6,4,7], k=13

Output: false

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Prefix Sum problems