Jelly, (削除) 6 (削除ここまで) 5 bytes
-1 byte thanks to @Dennis (use a cumulative reduction)
<2\IẠ
All test cases are at **TryItOnline**
How?
<2\IẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
< - less than comparison (a dyad)
2 - literal 2 (a nilad)
\ - n-wise overlapping reduction when preceded by a dyad-nilad chain
(i.e. reduce the list by pairs with less than)
e.g. [1,0,1] or [1,0,1,1]
I - consecutive differences, e.g. [-1,1] or [-1,1,0]
Ạ - All, 0 if any values are 0 else 1, e.g. 1 or 0
Works for either all uppercase or all lowercase.
Jonathan Allan
- 115.4k
- 8
- 68
- 293