There is an integer array arr[n] and an integer value d. The array is indexed from 1 to n. Count the number of distinct triplets (i, j, k) such that 0 < i < j < k โค n and the sum (a[i] + a[j] + a[k]) is divisible by d.
Example: a = [3, 3, 4, 7, 8], d = 5. The following triplets are divisible by d = 5. These are the triplets whose sum is divisible by d (1-based indexing):
ยท indices (1, 2, 3), s
Asked in: UKG
There is an array of n non-negative integers, arr. In one operation, some positive integer x is chosen and 1 is subtracted from all the numbers of the array which are greater than or equal to x. Find the number of different final arrays possible after the operation is applied 0 or more times. Return the answer modulo (10^9 + 7).
Note: 1-based indexing is used. Different values of x can be chose
Asked in: UKG