damn i have never seen anyone write this like that lol. why dont you just use O(n^2)?
And wouldnt you rather then say that your dictionary one would be O(n+m) with m <= n?
'isset' is not needed. The ternary operator will check the key for existence.
'end', it seems to me, is better to replace it with '$ drink_array [anything else]' or replace it with a special variable '$ defoult = "Beer"'. So this key can stand not only at the end of the array. But 'end' works faster
xor solution is n. Most efficient
its goway names like these
The greater the distance between a name's declaration and its uses,
the longer the name should be.
https://go.dev/talks/2014/names.slide#4
damn i have never seen anyone write this like that lol. why dont you just use O(n^2)?
And wouldnt you rather then say that your dictionary one would be O(n+m) with m <= n?
This comment is hidden because it contains spoiler information about the solution
'isset' is not needed. The ternary operator will check the key for existence.
'end', it seems to me, is better to replace it with '$ drink_array [anything else]' or replace it with a special variable '$ defoult = "Beer"'. So this key can stand not only at the end of the array. But 'end' works faster