**Hint 1:** Think about how you can partition the array into three parts: elements less than the pivot, elements equal to the pivot, and elements greater than the pivot. This will help you satisfy the conditions mentioned in the problem statement.
**Hint 2:** Consider using a two-pointer approach. One pointer can start from the beginning of the array and move towards the end, while the other pointer can start from the end of the array and move towards the beginning. This will allow you to efficiently partition the array into the three parts.
**Hint 3:** When iterating through the array, keep track of the number of elements less than the pivot and the number of elements greater than the pivot. This will help you determine when to stop moving the pointers.
**Hint 4:** Think about how you can use the relative order of the elements less than and greater than the pivot to your advantage. For example, if you find an element that is less than the pivot, you can move the first pointer forward and update the count of elements less than the pivot. Similarly, if you find an element that is greater than the pivot, you can move the second pointer backward and update the count of elements greater than the pivot