I attempted question 899E - Segments Removal using map. I had to search for largest element in the map. In my first attempt i used rbegin function and got TLE on test case 7. Submission : 41265428 So i changed the code and instead of using number as keys i used -1*number as keys and used begin function and my code got accepted. Submission : 41266306
What is going on behind the scenes ?