Find C++
Intuition\nFind Position of 1 and n\nResult = ind_one + (n - ind_n + 1) (Calculating Swaps)\nBut if ind_one is on left of ind_n, it means you one swap operation
# Intuition\n**Find Position of ```1``` and ```n```**\n**```Result = ind_one + (n - ind_n + 1)```** (Calculating Swaps)\n**But if ind_one is on left of ind_n, it means you one swap operation will be common for both i.e ```swap(1, n)``` so will do ```Result - 1```**\n\n# Code\n```\nclass Solution {\npublic:\n    int semiOrderedPermutation(vector<int>& nums) {\n        int n = nums.size();\n        int ind_One = find(nums.begin(), nums.end(), 1) - nums.begin(), ind_N = find(nums.begin(), nums.end(), n) - nums.begin();\n        int Result = ind_One + n - (ind_N + 1);\n        if(ind_One > ind_N)    // One on left of N\n            return Result - 1;\n        return Result;\n    }\n};\n```
['C++']