Java Easy Solution | 100% faster | O(1) space
\nclass Solution {\n    public int[] applyOperations(int[] nums) {\n        for (int i = 0; i < nums.length - 1; i++){\n            if (nums[i] == nums[i + 1]){
```\nclass Solution {\n    public int[] applyOperations(int[] nums) {\n        for (int i = 0; i < nums.length - 1; i++){\n            if (nums[i] == nums[i + 1]){\n             nums[i] *= 2;\n             nums[i + 1] = 0;\n         }\n        }\n        \n        move(nums);\n        return nums;\n    }\n    \n    //move zeroes to end\n    public void move(int arr[]) {\n\t\tint count=0;\n\t\tfor(int i=0;i<arr.length;i++) {\n\t\t\tif(arr[i]!=0)\n\t\t\t{\n\t\t\t\tint temp=arr[count];\n\t\t\t\tarr[count] = arr[i];\n\t\t\t\tarr[i]= temp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t}\n}\n```
['Java']