DP World interview question

Leet code medium level problems