End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
n is less than or equal to 3, return n - 1 since we must perform at least one split and splitting into 1s would not be beneficial.n is divisible by 3, return 3^(n/3).n modulo 3 is 1, return 3^((n/3) - 1) * 4.n modulo 3 is 2, return 3^(n/3) * 2.