You are given an integer array nums containing distinct values.
In each operation, you can perform one of the following actions:
If the first element of the array is the smallest element currently present in nums, remove it.
Otherwise, move the first element from the front to the end of nums.
Return the total number of operations required to make nums empty.
Constraints:
nums.length
nums[i]
All values in nums are distinct.
You are given an integer array nums containing distinct values.
In each operation, you can perform one of the following actions:
If the first element of the array is the smallest element currently present in nums, remove it.
Otherwise, move the first element from the front to the end of nums.
Return the total number of operations required to make nums empty.
Constraints:
nums.length
nums[i]
All values in nums are distinct.