leetcode

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

1051.cpp (298B)


0 class Solution {
1 public:
2 int heightChecker(vector<int> &heights) {
3 int count = 0;
4 vector<int> exp = heights;
5 sort(exp.begin(), exp.end());
7 for (int i = 0; i < heights.size(); i++)
8 if (heights[i] != exp[i]) count++;
10 return count;
11 }
12 };