LiquidHub interview question

Medium to hard level