Re:Most common phone interview question at Google
by fancyfredbot on Saturday May 02, 2020 @03:06PM
(#23054086)
It's not wrong! For some value of N it is an order of magnitude faster. It's just a bit misleading.
[ Parent
| on HN ]
Re:Most common phone interview question at Google
by eesmith on Saturday May 02, 2020 @03:12PM
(#23054131)
For another value of N it's three orders of magnitude faster.
In the example case where s[0] == s[1], it might be an order of magnitude slower, if there's much object initialization for the lookup table.