#3524
Find X Value of Array I
expert · 1065 · lc medium +32 · 37.2% accepted · 84 likes · top 15%
Description
Given positive integer array nums and positive integer k, count in how many ways you can trim a (possibly empty) prefix and a (possibly empty) suffix from nums (keeping at least one element) so the product of the remaining elements is congruent to x modulo k.
Return array result of size k where result[x] gives the count for remainder x.
Code
1
2
3