Flipkart interview question

rope cutting problem of heap. basic question on graph.