Sunteți pe pagina 1din 1

Question: We are given an array of 2n integers wherein each pair in this array of integers represents the year of birth

and the year of death of a dinosaurs respectively. The range of valid years we want to consider is [-100000 to 2005]. For example, if the input was: -80000 -79950 20 70 22 60 58 65 1950 2004 it would mean that the first dinosaur had a birth year of 80000 and an year of death of 79950 respectively. Similarly the second dinosaur lived from 20 to 70 and so on and so forth. We would like to know the largest number of dinosaurs that were ever alive at one time. Write a method to compute this, given the above array of 2n integers. Write one of the following methods: C/C++: int find_max_dinosaur (int[] years); Java : public int findMaxdinosaur (int[] years);

S-ar putea să vă placă și