Question
A device packs several fields into one non-negative integer, and the lowest k bits hold a rolling counter. Given the packed value n (0 <= n < 2^31) and a width k (0 <= k <= 30), return the counter: the integer formed by the lowest k bits of n. When k is 0 the counter is empty, so return 0. For example, n = 173 (binary 10101101) with k = 4 returns 13 (binary 1101).
low_bits_value(n: int, k: int) → int[173,4]out13[37,5]out5State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.