Semi Ordered Permutation Solution in C
IntuitionApproachComplexity

Time complexity:
o(n)


Space complexity:
O(1)

Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
o(n)

- Space complexity:
O(1)

# Code
```c []
int semiOrderedPermutation(int* nums, int numsSize) {
    int one_index = 0, n_index = 0;
    for (int i=0;i<numsSize;i++)
    {
        if (nums[i] == 1)
            one_index = i;
        if (nums[i] == numsSize)
            n_index = i;
    }
    if (one_index < n_index)
        return one_index + (numsSize - n_index - 1);
    else
        return one_index + (numsSize - n_index - 1)-1;
}
```
['C']