Accepted Two Sum code