a different appproach I thought and implemented but there are some failed test cases in hackerblocks.
Approach is explained in the code with comments
a different appproach I thought and implemented but there are some failed test cases in hackerblocks.
Approach is explained in the code with comments