Hello, can anyone clarifies this? I need to find consecutive segments that are odd or even. For example

2 6 5 = 2 and 6 = 2 consecutive even integers | 1 odd
4 6 8 1 3 = 4, 6, and 8 = 3 consecutive even integers | 1 and 3 consecutive odd integers 2
1 2 4 5 = 2 and 4 = 2 consecutive even integers | 1 odd
1 3 5 7 2 1 4 3 = 4 consecutive odd integers | 1 even

Edited by iceparticle.com

4
Contributors
5
Replies
32
Views
4 Years
Discussion Span
Last Post by sanjulovers

What would you expect as a result for the following sequence of integers?
1 2 3 6 7 8 11

Your last exampe, 1 3 5 7 2 1 4 3 is incorrect. It should be 4 odd, 2 even, 1 odd, 1 even, 1 odd.

And to answer niranga's question, the answer should be 1 odd, 1 even, 1 odd, 1 even, 1 odd, 1 even, 1 odd... :-)

Edited by rubberman

@rubberman
why is it 2 even? in 1 3 5 7 2 1 4 3
4 odd,2 even,1 odd,1 even,1 odd

for me this should be

1,3,5,7 = 4 odd
2 = 1 even
1 = 1 odd
4 = 1 even
3 = 1 odd

@niranga
1 2 3 6 7 8 11
1 = 1 odd
2 = 1 even
3 = 1 odd
6 = 1 even
7 = 1 odd
8 = 1 even
11 = 1 odd