Infosys Interview Question

they askerd an hard level graph problem