[Solved] largest number of dinosaurs that were ever alive [duplicate]


I would do something like:

  1. create a map to hold the data
  2. read in a pair
  3. For i = pair.first to pair.second ++map[i]
  4. if there are more pairs, repeat from 2
  5. Find the element in the map with the largest count. The key for that element is the year.

In theory, you could use a vector instead of a map, but it’s probably going to be sparsely enough populated that a map makes more sense.

0

solved largest number of dinosaurs that were ever alive [duplicate]