Three Way Partitioning Leetcode