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 Answer

added 44 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

[Jelly][1]Jelly, 6 [bytes][2](削除) 6 (削除ここまで) 5 bytes

-1 byte thanks to @Dennis (use a cumulative reduction)

<"ḊṖIẠ<2\IẠ

All test cases are at [TryItOnline][3]**TryItOnline**

How?

<"ḊṖIẠ<2\IẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
<  - less -than dequeue,comparison s[1:],(a dyad)
 2 - literal 2 (a nilad)
 \ - n-wise overlapping reduction when preceded by a dyad-nilad chain
 e (i.ge. "UMP"reduce the list by pairs orwith "UMPY"less than)
<" - zip with less than comparison, e.g. [1,0,1,P] or [1,0,1,1,Y]
  - pop the last element from this result, 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. [1]: https://github.com/DennisMitchell/jelly [2]: https://github.com/DennisMitchell/jelly/wiki/Code-page [3]: http://jelly.tryitonline.net/#code=PCLhuIrhuZZJ4bqgCsW8w4figqxL4oKsWQ&input=&args=IkFCQSIsIkFCQiIsIkJBQiIsIkJVTVAiLCJCQUxEIiwiQkFMRFkiLCJVUFdBUkQiLCJFWEFNSU5BVElPTiIsIkFaQllDWERXRVZGVUdUSFNJUkpRS1BMT01OIiwiQUFBIiwiQkJBIiwiQUNFIiwiVEhFIiwiQlVNUFkiLCJCQUxESU5HIiwiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoi

[Jelly][1], 6 [bytes][2]

<"ḊṖIẠ

All test cases are at [TryItOnline][3]

How?

<"ḊṖIẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
  - dequeue, s[1:], e.g. "UMP" or "UMPY"
<" - zip with less than comparison, e.g. [1,0,1,P] or [1,0,1,1,Y]
  - pop the last element from this result, 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. [1]: https://github.com/DennisMitchell/jelly [2]: https://github.com/DennisMitchell/jelly/wiki/Code-page [3]: http://jelly.tryitonline.net/#code=PCLhuIrhuZZJ4bqgCsW8w4figqxL4oKsWQ&input=&args=IkFCQSIsIkFCQiIsIkJBQiIsIkJVTVAiLCJCQUxEIiwiQkFMRFkiLCJVUFdBUkQiLCJFWEFNSU5BVElPTiIsIkFaQllDWERXRVZGVUdUSFNJUkpRS1BMT01OIiwiQUFBIiwiQkJBIiwiQUNFIiwiVEhFIiwiQlVNUFkiLCJCQUxESU5HIiwiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoi

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.

added 48 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly [Jelly][1], 6 bytes [bytes][2]

<"ḊṖIẠ

All test cases are at TryItOnline [TryItOnline][3]

How?

<"ḊṖIẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
 Ḋ - dequeue, s[1:], e.g. "UMP" or "UMPY"
<" - zip with less than comparison, e.g. [1,0,1,P] or [1,0,1,1,Y]
 Ṗ - pop the last element from this result, 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. [1]: https://github.com/DennisMitchell/jelly [2]: https://github.com/DennisMitchell/jelly/wiki/Code-page [3]: http://jelly.tryitonline.net/#code=PCLhuIrhuZZJ4bqgCsW8w4figqxL4oKsWQ&input=&args=IkFCQSIsIkFCQiIsIkJBQiIsIkJVTVAiLCJCQUxEIiwiQkFMRFkiLCJVUFdBUkQiLCJFWEFNSU5BVElPTiIsIkFaQllDWERXRVZGVUdUSFNJUkpRS1BMT01OIiwiQUFBIiwiQkJBIiwiQUNFIiwiVEhFIiwiQlVNUFkiLCJCQUxESU5HIiwiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoi

Jelly, 6 bytes

<"ḊṖIẠ

All test cases are at TryItOnline

How?

<"ḊṖIẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
 Ḋ - dequeue, s[1:], e.g. "UMP" or "UMPY"
<" - zip with less than comparison, e.g. [1,0,1,P] or [1,0,1,1,Y]
 Ṗ - pop the last element from this result, 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

[Jelly][1], 6 [bytes][2]

<"ḊṖIẠ

All test cases are at [TryItOnline][3]

How?

<"ḊṖIẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
 Ḋ - dequeue, s[1:], e.g. "UMP" or "UMPY"
<" - zip with less than comparison, e.g. [1,0,1,P] or [1,0,1,1,Y]
 Ṗ - pop the last element from this result, 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. [1]: https://github.com/DennisMitchell/jelly [2]: https://github.com/DennisMitchell/jelly/wiki/Code-page [3]: http://jelly.tryitonline.net/#code=PCLhuIrhuZZJ4bqgCsW8w4figqxL4oKsWQ&input=&args=IkFCQSIsIkFCQiIsIkJBQiIsIkJVTVAiLCJCQUxEIiwiQkFMRFkiLCJVUFdBUkQiLCJFWEFNSU5BVElPTiIsIkFaQllDWERXRVZGVUdUSFNJUkpRS1BMT01OIiwiQUFBIiwiQkJBIiwiQUNFIiwiVEhFIiwiQlVNUFkiLCJCQUxESU5HIiwiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoi

deleted 1 character in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 6 bytes

<"ḊṖIẠ

All test cases are at TryItOnline

How?

<"ḊṖIẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
 Ḋ - dequeue, s[1:], e.g. "UMP" or or "UMPY"
<" - zip with less than comparison, e.g. [1,0,1,P] or [1,0,1,1,Y]
 Ṗ - pop the last element from this result, 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

Jelly, 6 bytes

<"ḊṖIẠ

All test cases are at TryItOnline

How?

<"ḊṖIẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
 Ḋ - dequeue, s[1:], e.g. "UMP" or "UMPY"
<" - zip with less than comparison, e.g. [1,0,1,P] or [1,0,1,1,Y]
 Ṗ - pop the last element from this result, 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

Jelly, 6 bytes

<"ḊṖIẠ

All test cases are at TryItOnline

How?

<"ḊṖIẠ - main link takes an argument, s, e.g. "BUMP" or "BUMPY"
 Ḋ - dequeue, s[1:], e.g. "UMP" or "UMPY"
<" - zip with less than comparison, e.g. [1,0,1,P] or [1,0,1,1,Y]
 Ṗ - pop the last element from this result, 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
added 408 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading

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