Leetcode 3621. Number of Integers With Popcount-Depth Equal to K I
Count how many integers x in [1, n] take exactly k repeated applications of popcount (number of 1-bits) to reach 1 — equivalently, classify numbers by their initial popcount that lead to a depth k. The core challenge is mapping the popcount chain (k ≤ 5) and counting bit-strings ≤ n with those popcounts efficiently using combinatorics/binomial coefficients or a bitwise digit-DP since n can be large (up to 1e15).
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.