We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This would be a wonderful solution, and indeed, it works with the test cases. However, it gives the wrong prediction, when you have 0^0^0 (which is 0, and not 1).
Try the following input:
5 // 0 0 0 0 0 // 5 // 1 1 // 1 2 // 1 3 // 1 4 // 1 5
Your output will be: Even, Odd, Odd, Odd, Odd.
But it should be: Even, Odd, Even, Odd, Even.
Even Odd Query
You are viewing a single comment's thread. Return to all comments →
This would be a wonderful solution, and indeed, it works with the test cases. However, it gives the wrong prediction, when you have 0^0^0 (which is 0, and not 1).
Try the following input: 5 // 0 0 0 0 0 // 5 // 1 1 // 1 2 // 1 3 // 1 4 // 1 5 Your output will be: Even, Odd, Odd, Odd, Odd. But it should be: Even, Odd, Even, Odd, Even.
The problem statement says that no consecutive two numbers in the arrays will ever be 0. So this case is ruled out.