Skip to content

Commit fccf25d

Browse files
committed
Time: 153 ms (79.76%) | Memory: 83.1 MB (68.40%) - LeetSync
1 parent ae15ccc commit fccf25d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public:
3+
int reductionOperations(vector<int>& n) {
4+
int res = 0, sz = n.size();
5+
sort(begin(n), end(n));
6+
for (int j = sz - 1; j > 0; --j)
7+
if (n[j - 1] != n[j])
8+
res += sz - j;
9+
return res;
10+
}
11+
};

0 commit comments

Comments
 (0)