VacuumLabs Interview Question

they asked one difficult algorithm question