Self Explanatory Code | Explained with Steps
arr[i] =  2*i + 1 ==> which will generate sequence of first odd numbers \nlet n = 5 => [1, 3, 5, 7, 9]\nlet n = 6 => [1, 3, 5, 7, 9, 11]\n\noptimal way to make 
arr[i] =  `2*i + 1` ==> which will generate sequence of first odd numbers \nlet n = 5 => [1, 3, 5, 7, 9]\nlet n = 6 => [1, 3, 5, 7, 9, 11]\n\noptimal way to make all equal is to make all numbers equals to n.\n\nwe will club two numbers together like 1, 9 take them to 5, 3, 7 take them to 5  =>  4 + 2 = 6\n\n```\nclass Solution {\n    public int minOperations(int n) {\n        int op = 0;\n        int odd = 1;\n        while(odd < n) {\n            op += n - odd;\n            odd += 2;\n        }\n        return op;\n    }\n}\n```
[]