I’m using a map to count votes for a voting system, so the vote string is the key, and the vote count is the value.
I sort the map to get the top vote, but now how do I access the top vote? A hack way of doing it I came up with was doing a for loop and breaking on the first iteration.
But what if there’s a tie? I need to check if the second element and first element have the same count?
I need to be able to access elements in ordered indices. Can I do that? Or is there something else that can help me?