Coding since 11yo, that makes it over 30 years now ~~~
Have a PhD in Comp Sci ~~~
Love to go on bike tours ~~~
I try to stay as generalist as I can in this crazy wide place coding is at now.
A TypeScript version using reduces and maps to avoid too much mutation.
The main loop early exits if possible (if there are no hills left), otherwise it erodes the mountainscape by one hill. The starPattern array determines how this erosion happens, and it seems that the challenge uses up-down-left-right-dot.
A TypeScript version using reduces and maps to avoid too much mutation.
The main loop early exits if possible (if there are no hills left), otherwise it erodes the mountainscape by one hill. The
starPattern
array determines how this erosion happens, and it seems that the challenge uses up-down-left-right-dot.Tested on Kata in its JS form.
Note that on there the mountains are defined using something like this: