Skip to content

2022-4: In the Long One...

Write a function that:

  • takes a right argument that is a Boolean scalar or vector.
  • returns the length of the longest sequence of consecutive 1s.

Hint: The partition function X⊆fY could be helpful.

Examples:

      (your_function) 1 1 1 0 1 1 0 0 1 1 1 1 0
4

      (your_function) ⍬
0

      (your_function) 1
1

      (your_function) 0
0

      (your_function) 12/0 1 0 1
12
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub