This was my first time solving such a problem, it took me considerable time to do also it was a part of the assessment for a data engineering interview which I was not avail