Yes, I mean that I use the map structure instead of set (I think go does not have sets 🤔 ). Let me paste here my pseudolike code:
func findValue: int
cache := new key-value-storage
for line = read-next-line from file:
nbr := convert line to nbr
want := 2020 - nbr
if cache[want]:
return want * nbr
cache[nbr] = nbr
return 0
So I mean "saving to a map" this line cache[nbr] = nbr. Of course the value could be anything, only the key counts ☺️
Yes, I mean that I use the map structure instead of set (I think go does not have sets 🤔 ). Let me paste here my pseudolike code:
So I mean "saving to a map" this line
cache[nbr] = nbr
. Of course the value could be anything, only the key counts ☺️Ohh yeah now I see 😊