I'm either making the worst dumb mistake I've made in a while, or the input from the checker is busted for the hash map approach. The question asks you to assume each input would have exactly one solution, but that assumption requires you to assume that no int in the input array is repeated. (I guess you can get super-semantic and argue that, because we can assume precisely one solution, any cases of repeated integers can be assumed to not be part of that solution, but that seems a bit too cutesy for such an introductory level problem.)
Unfortunately, my code was busted by this collection of numbers from the submission checker:
[... 125 136 168 173 173 180 199 ... ]
(Note that I sorted the array to find out if there was repeating input, which explains why the numbers are ordered.)
Am I missing something here? In Java I think a .put() of an already-extant key would silently overwrite with a new value. In C#, <Dictionary>.Add() crashes with an argument exception on repeated keys. That's besides the fact that the solution in general becomes ambiguous with repeated ints.
This is literally my first problem I've tried on LeetCode though, so I'm feeling like I might just be missing something.