JavaScript O(N) with easy explanation
\nvar minDeletion = function(nums) {\n    \n    let n = nums.length;\n    \n    let k = 0;\n    for(let i = 0; i<n-1; i++) {\n        \n        /*\n            
```\nvar minDeletion = function(nums) {\n    \n    let n = nums.length;\n    \n    let k = 0;\n    for(let i = 0; i<n-1; i++) {\n        \n        /*\n            if i delete one element then all elements to right of it shift by one \n            likewise for k deleted elements, indexes of the elements of right to them will become i-k\n            so we have to check i - k is even or not if even and adjacent elements are same then i \n            will be deleting one more element.\n            \n        \n            i am checking nums[i] === nums[i+1] for index i not for index i - k because i am not                 deleting it but \n            just counting it that how many of them i will be deleting as of now.\n        */\n        \n        if((i - k)%2 === 0 && nums[i] === nums[i + 1]) {\n            k++;\n        }\n        \n    }\n    \n    //after deletion if arrays length is odd then delete just one element from last.\n    if((n-k)%2 == 1) k++;\n    \n    return k;\n    \n    \n};\n```
['JavaScript']