C++ / Java ||  With explanation O(1) space
\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        \n        int deletion(0), n(size(nums));\n        \n        for (int i=0; i<n-1;
```\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) {\n        \n        int deletion(0), n(size(nums));\n        \n        for (int i=0; i<n-1; ) {\n            int newIndex = i-deletion; // index will alter by number of deletions done.\n            if ((newIndex % 2 == 0) and nums[i] == nums[i+1])   deletion++;\n            else    i++;\n        }\n        return ((n-deletion) % 2 == 0) ? deletion : deletion+1;\n        // if size of array after removing satisfying 2nd condition is odd then we need to delete one more element to make it even.\n    }\n};\n```\n\n**Java Solution**\n\n```\nclass Solution {\n    public int minDeletion(int[] nums) {\n        \n        int deletion = 0, n = nums.length;\n        \n        for (int i=0; i<n-1; ) {\n            int newIndex = i-deletion;\n            if ((newIndex % 2 == 0) && nums[i] == nums[i+1])   deletion++;\n            else    i++;\n        }\n        return ((n-deletion) % 2 == 0) ? deletion : deletion+1;\n    }\n}\n```\n**Upvote if it helps :)**\n
['C', 'Java']