#3624

Number of Integers With Popcount-Depth Equal to K II

expert · 1210 · lc hard +32 · 59.4% accepted · 34 likes · top 57%

Description

An integer array nums and queries are given. The popcount-depth of x is found by repeatedly applying popcount (count of set bits) until reaching 1, counting the steps taken.

Each query is one of:

- [1, l, r, k]: Count indices j in [l, r] where the popcount-depth of nums[j] equals k.

- [2, idx, val]: Set nums[idx] = val.

Return an array of answers to all type-1 queries in order.

Code

1
2
3