Hello I need to write a function that only takes an array as parameter(this is the one and only parameter) but u can variables

The method should return the maximum number of values in a row that their sum is divisible by 2 for example

For [2,5] it returns 1 because 2 is divisble by2

For [2,1,2] also 1 becasue only 2 is divisble by in a row

For [4,2,4] it returns 3

For [3,3,1] returns 2

In the complexity of O(n)

Please help

The method should return the maximum number of values in a row that their sum is divisible by 2 for example

For [2,5] it returns 1 because 2 is divisble by2

For [2,1,2] also 1 becasue only 2 is divisble by in a row

For [4,2,4] it returns 3

For [3,3,1] returns 2

In the complexity of O(n)

Please help

Last edited: