[C++] Beats 100% | Easy to understand solution
\nint minOperations(int n) {\n        if(n == 1) return 0;\n        int ans = 0;\n        if(n % 2 == 0){\n            // int avg = n;\n            for(int i = 
```\nint minOperations(int n) {\n        if(n == 1) return 0;\n        int ans = 0;\n        if(n % 2 == 0){\n            // int avg = n;\n            for(int i = 0; i < n/2 ; i++){\n                ans += (n - (2 * i + 1));\n            }\n        }\n        else{\n            int val = 2 * (n/2) + 1;\n            for(int i = 0; i < n/2; i++){\n                ans += (val - (2*i + 1));\n            }\n        }\n        return ans;\n    }\n```\nHit upvote if you liked the answer.
['C++']