A bird flying high above a mountain range is able to estimate the height of the highest peak.
Can you?
Example
The Birds Eye View
The Bird-brai...
For further actions, you may consider blocking this person and/or reporting abuse
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:
Clojure solution:
Not as elegant as I hoped. Debugging output included.