WeRide interview question

Array and graph analysis question