Question
Given an integer array nums
and an integer k
, return the number of non-empty subarrays that have a sum divisible by k
.
A subarray is a contiguous part of an array.
https://leetcode.com/problems/subarray-sums-divisible-by-k/
- Solution1
1 | class Solution { |
Complexity:
Time complexity: O( n)
Space complexity: O(n)