Leetcode 3524. Find X Value of Array I
Count, for every x in [0, k-1], how many contiguous non-empty subarrays (equivalently removing a prefix and a suffix) have product ≡ x (mod k). The core challenge is doing this efficiently when multiplicative inverses modulo k may not exist (elements can share factors with k), typically handled by factoring k and tracking residue classes or prime-power exponents alongside prefix products.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.