Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

5 of 5
added 44 characters in body
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

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

AltStyle によって変換されたページ (->オリジナル) /