You are given an integer array nums and two integers a and b such that a b.
An array is considered partitioned if it can be divided into three contiguous segments:
The first segment contains all elements strictly less than a.
The second segment contains all elements greater than or equal to a and less than or equal to b.
The third segment contains all elements strictly greater than b.
In one operation, you may swap any two adjacent elements in nums.
Return the minimum number of adjacent swaps required to make nums partitioned.
Constraints:
nums.length
nums[i]
a b
You are given an integer array nums and two integers a and b such that a b.
An array is considered partitioned if it can be divided into three contiguous segments:
The first segment contains all elements strictly less than a.
The second segment contains all elements greater than or equal to a and less than or equal to b.
The third segment contains all elements strictly greater than b.
In one operation, you may swap any two adjacent elements in nums.
Return the minimum number of adjacent swaps required to make nums partitioned.
Constraints:
nums.length
nums[i]
a b