fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. string ltrim(const string &);
  6. string rtrim(const string &);
  7.  
  8.  
  9. /*
  10.  * Complete the 'countStudents' function below.
  11.  *
  12.  * The function is expected to return an INTEGER.
  13.  * The function accepts INTEGER_ARRAY height as parameter.
  14.  */
  15.  
  16. int countStudents(vector<int> height) {
  17. int n = height.size();
  18. vector<int> a;
  19. for (auto x: height) a.push_back(x);
  20. sort(a.begin(), a.end());
  21.  
  22. int ans = 0;
  23. for (int i = 0; i < n; i++) {
  24. if (height[i] != a[i]) ans++;
  25. }
  26. return ans;
  27. }
  28. int main()
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:28:10: error: expected initializer at end of input
 int main()
          ^
stdout
Standard output is empty