Balad Interview Question

it was mostly about the algorithmic thinking.