[JAVA]Simple Detailed Solution with O(N) time O(1) space!!
The idea is simple go through the array along with checking the conditions!!\n\n\n\n        int counter = 0;\n        for (int i = 0; i < nums.length - 1; i += 
The idea is simple go through the array along with checking the conditions!!![image](https://assets.leetcode.com/users/images/6da47595-c4b9-4910-964f-e72286e9bf76_1648356113.8899364.jpeg)\n\n\n```\n        int counter = 0;\n        for (int i = 0; i < nums.length - 1; i += 2) { // the second condition given\n            if (nums[i] == nums[i + 1]) {\n                counter++;\n                i--;\n            }\n        }\n\t\treturn (nums.length - counter) % 2 == 1?++counter: counter; //checking if the array is even\n```
['Java']