Three-way partition by pivot
Your task
Given an integer array a and an integer pivot, perform a three-way partition conceptually splitting elements into those less than, equal to, and greater than the pivot. Return a list of three integers: [count_less, count_equal, count_greater]. The array may be empty.
Examples
three_way_partition(a: list[int], pivot: int) -> list[int]Example 1
Input
three_way_partition([1, 4, 2, 4, 2, 4, 1, 3], 4)Output
[5, 3, 0]