✅ C++ || Easy to Understand || Using a Single Loop
\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) \n    {\n        int size = nums.size();\n\t\tint ans = 0;\n\t\tfor(int i=0;i<size-1;i++)\n\
```\nclass Solution {\npublic:\n    int minDeletion(vector<int>& nums) \n    {\n        int size = nums.size();\n\t\tint ans = 0;\n\t\tfor(int i=0;i<size-1;i++)\n\t\t{\n\t\t\tif(nums[i] == nums[i+1])\n                ans++;\n                \n\t\t\telse\n                i++;\n\t\t}\n        \n        // for the even length both are even or odd \n        // if they are not then we will remove the last element for making nums even\n        // and for that removing increase the cnt by 1\n\t\tif(size % 2 == 0  and ans % 2 != 0)\n            ans++;\n        \n\t\tif(size % 2 == 1 and ans % 2 == 0)\n            ans++;\n        \n        // if nums is already even then return it\n\t\treturn ans;\n    }\n}\n```
[]