DHL Supply Chain interview question

Maximum pseudocodes are from C language