I have an array of shape (2 n), and I want to determine if it has a kind of 
alternating pattern, where 1s must appear on alternate rows, when reading from 
left to right.

Some examples that do 'alternate':

1 0 0 1 0 1
0 1 0 0 1 0

0 1 0 1 0
1 0 1 0 1

0 0 1 0 0 0 0 1
1 0 0 0 1 0 0 0

Some examples that do not 'alternate':

1 0 0 0 1
0 1 1 0 0

1 0 0 1 0 1 1
0 1 0 0 1 0 0

0 1 0 0 1 0
1 0 1 1 0 0


How can I recognise these cases?

Thanks.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to