🔥 O(1) space | easy java solution with explanation  ✅
\nHere to Make the array Beautiful array have to satisfy  two conditions : \n nums.length is even.\n nums[i] != nums[i + 1] for all i % 2 == 0.\n\nHere , we wil
\nHere to Make the array Beautiful array have to satisfy  two conditions : \n* nums.length is even.\n* nums[i] != nums[i + 1] for all i % 2 == 0.\n\nHere , we will first try to satisfy condition 2 and later when all elements have satisfied the 2nd condition.Then only, we will verify 1st condition.\n\n***Checking Second Condition*** \uD83D\uDC48\nFirst we will check  even indexes . If we delete any element then all elements after that particular index will shift to left by 1 index. but we can\'t do this because it will take o(n) time for each deletion.\nSo, for this reason we will use a boolean variable. This boolean will tell us whether to check odd indexes or even indexes.\nIf no. of Deletions is even it will check even indexes and if no. of deletions is odd it will check odd indexes.\n\n***Checking First condition*** \uD83D\uDC48 \nSince all the elements satisfy Second condition. So , removing last elemnent from the array (if array length is           odd) will not affect other elements & they will still satisfy second condition.\n\n\n\n\n\n```\n\tclass Solution {\n    public int minDeletion(int[] nums) {\n        int n = nums.length ,count = 0;\n        boolean flag = true; // We will use this boolean variable to check whether to check any particular index or not\n\t\t\n        \n\t\t//Checking first condition whether nums[i] != nums[i + 1] for any required index\n\t\t\n        for(int i=0;i<(n-1);i++){\n            if(flag == true){\n               if((i&1) == 0 && nums[i] == nums[i+1]){\n                    count++;\n                    flag = false;\n               }\n            }else{\n                if((i&1) == 1 && nums[i] == nums[i+1]){\n                    count++;\n                    flag = true;\n               }\n            }\n        }\n\t\t//Checking whether length of array after deletions is odd or even if it is odd remove last element else do nothing \n        if((n-count)%2 == 0) return count; // n-count -> length of array after deletion\n        return (count + 1); \n    }\n}\n```
['Two Pointers', 'Greedy', 'Java']