Question: How to find the offset, and the period, comparing two boolean arrays in Java? For example, these two arrays have a an offset of 6,
How to find the offset, and the period, comparing two boolean arrays in Java?
For example, these two arrays have a an offset of 6, and period of 3.
| F | T | F | T | T | T | T | T | F | T | T | F |
| F | T | F | T | T | T | T | T | F | T | T | F |
Because the the offset of 6 which is F T F T T T, then it has a patter T T F T T F, with period begin 3.
It should work in any other two boolean arrays with different offests. and different period,like another example
| F | F | T | F | T | F | T | F |
| F | F | T | F | T | F | T | F |
This has an offset of 4, F F T F, and then T F T F, which is period of 2, since the pattern repeats.
Thanks.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
