Skip to content

Commit e19073a

Browse files
committed
solution-1051
1 parent 8cfc479 commit e19073a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

1051-Height-Checker.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public:
3+
int heightChecker(vector<int>& heights) {
4+
5+
vector<int>A= heights;
6+
sort(A.begin(),A.end());
7+
int count=0;
8+
for(int i=0;i<A.size();i++)
9+
{
10+
if(A[i]!=heights[i])
11+
{
12+
count++;
13+
}
14+
}
15+
return count;
16+
}
17+
};

0 commit comments

Comments
 (0)