leftMax and rightMin, of the same length as the input array nums.\n2. Set leftMax[0] to the smallest possible integer and rightMin[-1] to the largest possible integer.\n3. Iterate through nums from left to right, updating leftMax such that leftMax[i] is the maximum value encountered so far.\n4. Iterate through nums from right to left, updating rightMin such that rightMin[i] is the minimum value encountered so far.\n5. Initialize a counter count to 0.\n6. Iterate through nums and increment count for each element that is greater than leftMax[i] and less than rightMin[i].\n7. Return the value of count.