https://practice.geeksforgeeks.org/problems/three-way-partitioning/1