O(n) Varun
Elegant solutionnnnn.\n\nclass Solution {\n    public int minDeletion(int[] arr) { // odd even // 1 1 1 2 3 4 4;\n        if(arr.length == 1) return 1;\n       
Elegant solutionnnnn.\n```\nclass Solution {\n    public int minDeletion(int[] arr) { // odd even // 1 1 1 2 3 4 4;\n        if(arr.length == 1) return 1;\n        \n        Queue<Integer> even = new ArrayDeque<>(); //  \n        Queue<Integer> odd = new ArrayDeque<>();  //  \n        int cnt = 0;\n        boolean flag = true;\n        for(int val : arr){\n            if(flag){\n                even.add(val);\n\n            } else{\n                odd.add(val);\n\n            }\n            flag = !flag;\n        }\n \n        \n        int count = 0;\n        while(even.size() > 0 && odd.size() > 0){\n\n            if(even.peek() == odd.peek()){\n                \n                even.remove();\n                count++;\n                \n                Queue<Integer> temp = even;\n                even = odd;\n                odd = temp;\n                \n            } else{\n                even.remove();\n                odd.remove();\n            }\n        }\n        \n        if(even.size() != 0){\n            even.remove();\n            count++;\n        } else if(odd.size() != 0){\n            odd.remove();\n            count++;\n        }        \n        \n        return count;        \n    }\n    \n    public static void swap(Queue<Integer> even, Queue<Integer> odd){\n        Queue<Integer> temp = even;\n        even = odd;\n        odd = temp;\n    }\n}\n```
[]