Code Room
CodingMediumcod-g1053
Subject Storage checksumLevel Mid–Senior~25 minCommon in Storage & CDN interviewsIndustries Software development, Technology

Question

Verify on-disk chunk integrity. A file is split into chunks; you are given two parallel lists: `chunks` (each a string of bytes) and `expected` (each an integer checksum that was stored when the chunk was written). The checksum of a chunk is defined deterministically as the Adler-32-style rolling sum: a = 1, b = 0; for each byte v of the UTF-8 encoding, a = (a + v) mod 65521 and b = (b + a) mod 65521; the checksum is (b * 65536 + a). Recompute each chunk's checksum and return a list of the 0-based indices of all chunks whose recomputed checksum does NOT match its expected value (i.e. corrupted chunks), in ascending index order. The two lists have equal length <= 10^4.

Implement
verify_chunks(chunks: list[str], expected: list[int]) → list[int]
Examples
in[["abc","abc"],[38600999,1]]out[1]
What a strong answer looks like

State 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.

Run or narrate your approach, then ask the coach.