Tap here to switch tabs
Problem
Submissions

Problem: Count Distinct Subarrays Divisible by K in Sorted Array

Try to solve the Count Distinct Subarrays Divisible by K in Sorted Array problem.

Statement

Given an array of integers nums sorted in non-descending order and an integer k, return the number of distinct subarrays whose sum of elements is divisible by k.

A subarray is defined as a contiguous sequence of elements within an array. Two subarrays are distinct if the sequences of values they contain are not identical.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • nums is sorted in non-descending order.

  • 1≤1 \leq k ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Distinct Subarrays Divisible by K in Sorted Array

Try to solve the Count Distinct Subarrays Divisible by K in Sorted Array problem.

Statement

Given an array of integers nums sorted in non-descending order and an integer k, return the number of distinct subarrays whose sum of elements is divisible by k.

A subarray is defined as a contiguous sequence of elements within an array. Two subarrays are distinct if the sequences of values they contain are not identical.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • nums is sorted in non-descending order.

  • 1≤1 \leq k ≤109\leq 10^9