# [Jelly], 10 bytes _ƝµṂƇNṖ⁼ṬƇ [Try it online!][TIO-km33bp88] [Jelly]: https://github.com/DennisMitchell/jelly [TIO-km33bp88]: https://tio.run/##tZQ9bsMwDIUv5OG9i3QvjKBTlyIX6JgsvkG23iBrBwOdWsD3cC6i/FgUSYlOshQChA@SbD3ykfp4324/U3qbvn6/53E/DS/zeDjtfubxOA3pbzjtj68p9T02Xc/NZerRXRkdryt5htlhnplP5Z1l3NaWwcJ0LGdYMQvLt3SMilGYjrNuw3BMx3AMowFGQ47YMRxLVuCYhWnibZnmDM1dNHdpLJ4ROMCGedcZNtxGZiNGw61SrjpJcxdXKuJxRmHcsFVTc@x8XCmtG7XzcCwaigOyKiclo3KT/E0UiRrroWZVc6oqVJuqV980exqnRq@5UvWaJ3VE49QK@sc@x0p2n6mauP/X3gsGHFUBgr691591JSJ8X3wlRtXt36ymz88 "Jelly – Try It Online" Semi-translation of [Leo's excellent Husk answer](https://codegolf.stackexchange.com/a/220491/85334). ``` _Ɲ Take the vectorized differences between adjacent elements. (The deltas builtin, I, vectorizes itself instead.) ṂƇ Filter by minimum, keeping elements containing -1. N Negate. Ṗ Remove the last element. ⁼ Is this list equal to µ the differences ṬƇ filtered to only elements containing 1? ``` `Ṭ` was originally `Ṁ` (maximum), but this produced a false negative on the first test case, as the largest element of `[-1]` is -1 rather than 0. `Ṭ` produces an array with ones at the provided indices and zeros elsewhere, but ignores non-positive indices, producing an empty array (which is falsy) if there are no positive indices. # [Jelly], <s>15</s> 13 bytes ṛa+ɗ\>TẇM{ʋƝP [Try it online!][TIO-km2rxi4x] [Jelly]: https://github.com/DennisMitchell/jelly [TIO-km2rxi4x]: https://tio.run/##tZQ9bgIxEIUPlC3eu0BuECkFDVooUtBEXCCio6HgABQoN@ACSRspErkFXMThx@OZsWchTWTJ@mR712/mzfh1Np@/pXT42L487DeTx9Hhc/W0@Fl/vz@nr9VxuRun1PeYdj2np6lHd2Z0PK/kGWaHeWY@lXeu47J2HSxMx3KGFbOwfEvHqBiF6TjrNgzHdAzHMBpgNOSIHcOxZAWOWZgm3pZpztDcRXOXxuIZgQNsmDedYcNtZDZiNNwq5aCTNHdxoCLuZxTGDVs1NcfOx5XSulE7D8eioTggq3JSMio3yd9EkaixHmpWNaeqQrWpevVNs6dxavSaK1WveVJHNE6toH/scwxk9y9VE/f/0HvBgKMqQNC3t/qzrkSE74uvxKi6/ZvV9Pkv "Jelly – Try It Online" *-2 removing `ṙ1` because the all-zeros pattern can essentially be ignored--if you flip the last bit off, you already know it's the one that's been on the longest* Takes input as an array of Boolean arrays, and outputs 0 or 1. ``` ɗ\ Cumulatively reduce the input by: ṛ right argument a vectorizing-logical-AND + the vectorized sum of the arguments. ṛa+ɗ\ This turns each 1 into how "long" it's been a 1, consecutively. ʋƝ For each pair of adjacent elements from that result: T are the indices at which > the right is less than the left ẇ a sublist of M{ the maximal indices of the left? P Take the product of the results. ```