Verification #28 · 2026-10-21 · Associative arrays · Easy · about 10 min
The histogram walk that skips the first address
addr_hist counts how often each address was seen, in the associative array cnt (address → count). Two methods walk it:
hottest(addr, n)returns the address seen most often and its count. If several addresses tie, the lowest one wins. It returns 1, or 0 with the outputs left alone if nothing has been seen.prune(min)removes every address seen fewer thanmintimes and returns how many it removed.
Run adds a few addresses. hottest picks the wrong one, and prune leaves one behind. Fix hist.sv.
Write and run your answer in the browser. The hidden tests check it, and it’s free.