4-line C++ solution to the problem
Intuition\n Describe your first thoughts on how to solve this problem. We can get the minimum number of operations only by making all the elements equal to n(ta
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->We can get the minimum number of operations only by making all the elements equal to n(target element).\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nAfter forming all the elements by the formula (2*i)+1, the summation of the differences between target element n and the elements lesser than that should give you the answer\n\n\n# Complexity\n- Time complexity: O(n/2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minOperations(int n) {\n        int sum=0;\n        for(int i=0; i<n/2; i++){\n            sum+=n-((2*i)+1);\n        }\n        return sum;\n    }\n};\n```
['Iterator', 'C++']