Why Swift sucks as a functional language
Briefly

If you select any value which isn't a local maxima, you are guaranteed to find one on the side of a neighbour that's greater than the current value. This fundamental insight can change how one approaches the problem of finding local maxima in arrays.
The example with values like [5, 15, 1, 6, 8, 9, 7] illustrates how selecting the middle position leads us on a guaranteed path to discovering a local maxima. By analyzing neighbors, we refine our approach to problem-solving.
Read at Medium
[
|
]