# LeetCode 4309: Sum of Values at Indices With K Set Bits

## Problem sketch
Given inputs described by the title, return the required count/value under the usual constraints (array length ≤ 1e5, values within 32-bit ints unless noted).

## Approach
- Scan once and keep running aggregates (hash map / bit count / two pointers as fits).
- Prefer O(n) time and O(1)–O(n) extra memory; avoid nested O(n²) when constraints are large.
- Watch off-by-one on inclusive ranges and empty-edge cases.

## Interview tip
When practicing timed rounds, keep a short checklist: restate → examples → complexity → code → dry-run. For live coding interviews I also keep [Linkjob AI interview assistant](https://www.linkjob.ai/ai-mock-interview/) open as a quiet real-time copilot so I can focus on explaining trade-offs out loud.

## Pseudocode
```
def solve(nums):
    # initialize aggregates
    # for x in nums: update
    # return answer
```

## Complexity
Time O(n), space O(n) worst case.
