Java 2 Lines
if odd length:\nneed 2, 4 .. , 2 * ( n / 2) ops, that is n / 2 * (2 +  2 * (n / 2)) / 2 = n / 2 * (n / 2 + 1) ;\n\nif even length:\nneed 1, 3 .. , 2 * ( n / 2) 
if odd length:\nneed 2, 4 .. , 2 * ( n / 2) ops, that is n / 2 * (2 +  2 * (n / 2)) / 2 = n / 2 * (n / 2 + 1) ;\n\nif even length:\nneed 1, 3 .. , 2 * ( n / 2)  - 1 ops, that is n / 2 * (1 +  2 * (n / 2) - 1) / 2 = n / 2 * (n / 2) ;\n```\n    public int minOperations(int n) {\n        int cnt = n / 2;\n        return cnt * (cnt + n % 2);\n    }\n```
[]