JAVA O(1) SPACE || EASY TO UNDERSTAND
\nclass Solution {\n    public int minDeletion(int[] nums) {\n        int n=nums.length;\n\n        int dlt=0;\n        for(int i=0;i<n-1;i++){\n            if(
```\nclass Solution {\n    public int minDeletion(int[] nums) {\n        int n=nums.length;\n\n        int dlt=0;\n        for(int i=0;i<n-1;i++){\n            if(nums[i]==nums[i+1] && (i-dlt)%2==0){  // i-dlt indicates the index shift in the left\n                dlt++;\n            }\n        }\n        if((n-dlt)%2==1){ // to have a even length array\n            dlt++;\n        }\n        return dlt;\n    }\n}\n```
[]