Interview question of the issue #176 of rendezvous with cassidoo.
You’re given a string of characters that are only 2s and 0s. Return the index of the first occurrence of “2020” without using the indexOf (or similar) function, and -1 if it’s not found in the string.
Example:
$ find2020('2220000202220020200')
$ 14
Just pnpm i
to install all dependencies and then pnpm t
to run the tests!