Company: MediaNet_21july
Difficulty: medium
Vanish the Gems Problem Description In front of you there is a treasure containing many gems, soon you realise that they are not as precious as they seem! Infact they are cursed with black magic and bring bad luck with them so you try to minimise the bad luck you get. You have the power to destroy 1 gem in 1 second. You can destroy gems in any order. You are given a 2D array A, where for i-th gem it takes A[i][0] seconds to give A[i][1] units of bad luck.At any instant, only one gem can give you the bad luck, and you can decide the order in which you want to receive the bad luck. Once the receiving of bad luck starts from any gem it cannot be destroyed and it automatically vanishes after giving A[i][1] units of bad luck. Although while receiving bad luck from any gem, you can choose to destroy any other gem which is available in the treasure. There is no time lapse in between receiving of bad lucks from any two gems. As soon as one gem finishes giving bad luck, you have to choose secon