Code RoomContent-addressable store
MediumPrep Room Coding #209

Content-addressable store

CodingStorage & CDNAlgorithms & data structuresMid–Senior~25 min

A content-addressable store deduplicates blobs: two blobs with identical content are stored once. You are given a list of blob contents (each a string). The store addresses each blob by a content hash defined deterministically as follows: h = 1469598103934665603; for each byte b of the UTF-8 encoding of the content, h = ((h XOR b) * 1099511628211) mod 2**64 (this is 64-bit FNV-1a). Two blobs collide-free iff their hashes differ; treat equal hashes as the same content. Each unique hash is stored exactly once and occupies len(content) bytes. Return the total number of bytes the store occupies after ingesting all blobs (sum of content lengths over unique hashes only). Up to 10^5 blobs.

Implement
cas_store_size(blobs: list[str]) → int
Examples
in[["abc","abc","de"]]out5
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.

0:00 of about 25 min
InputExpectedGot
[["abc","abc","de"]]5not run yetsample