[Jprogramming] Operations on boolean lists

Ric Sherlock tikkanz at gmail.com
Fri Oct 14 06:34:50 HKT 2011


On Fri, Oct 14, 2011 at 10:56 AM, David Vaughan
<purpleblues13 at googlemail.com> wrote:
> How could I test if a boolean list contains at least n consecutive 1's?
>
> e.g. for 3 consecutive 1's:
>
>   desiredverb 0 1 1 1 0 0
> 1
>   desiredverb 0 1 1 0 1 1
> 0
>   desiredverb 1 1 1 1 1 0
> 1

   1 1 1 +./@:E. 0 1 1 1 0 0
1
   1 1 1 +./@:E. 0 1 1 0 1 1
0
   1 1 1 +./@:E. 1 1 1 1 1 0
1

+./@:E. is backed by special code


More information about the Programming mailing list