Cisco interview question

DSA question based on graph