https://practice.geeksforgeeks.org/problems/max-length-chain/1