Easy C++ Code (Beats 100%)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int semiOrderedPermutation(vector<int>& nums) \n    {\n        int n=nums.size();\n        int op=0;\n        auto it1=find(nums.begin(),nums.end(),1);\n        int idx1=distance(nums.begin(),it1);\n        for(int i=idx1;i>0;i--)\n        {\n            swap(nums[i],nums[i-1]);\n            op++;\n        }\n        auto it2=find(nums.begin(),nums.end(),n);\n        int idx2=distance(nums.begin(),it2);\n        for(int i=idx2;i<n-1;i++)\n        {\n            swap(nums[i],nums[i+1]);\n            op++;\n        }\n        return op;\n    }\n};\n```
['C++']