Comment

Comment by williamkuszmaul

Unless I'm misreading, the question as stated in the blog post never says there is only one duplicate (there might be many!), so in that sense I think his answer may be wrong. A more robust solution is just to have an array of n counters and just count how many times each item appears.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton