Skip to content

Commit 3b43ba2

Browse files
authored
3644_CPP_solutionREADME.md
3644_CPP_solution
1 parent 044942b commit 3b43ba2

File tree

1 file changed

+11
-0
lines changed
  • solution/3600-3699/3644.Maximum K to Sort a Permutation

1 file changed

+11
-0
lines changed

solution/3600-3699/3644.Maximum K to Sort a Permutation/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3644.Ma
9595
#### C++
9696

9797
```cpp
98+
class Solution {
99+
public:
100+
int sortPermutation(vector<int>& nums) {
101+
if(is_sorted(nums.begin(),nums.end())) return 0;
102+
int ans=0x7fffffff;
103+
for(int i=0;i<nums.size();i++){
104+
if(nums[i]!=i) ans&=i;
105+
}
106+
return ans;
107+
}
108+
};
98109

99110
```
100111

0 commit comments

Comments
 (0)