leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1551.cpp (182B)


      1 // 1551. Minimum Operations to Make Array Equal
      2 class Solution {
      3   public:
      4     int minOperations(int n) {
      5         int k = n / 2;
      6         return n % 2 ? k * (k + 1) : k * k;
      7     }
      8 };