Search
⌘K

Leetcode 3671. Sum of Beautiful Subsequences

Compute the sum over all positive g of g times the number of strictly increasing subsequences of nums whose GCD equals g (mod 1e9+7). The algorithmic challenge is to count increasing subsequences while dynamically aggregating their gcds efficiently for up to 10^4 elements and values up to 7·10^4, typically via DP/maps that merge gcd states instead of naive enumeration.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.