Dear Saurabh Kher,

Thank you for applying to Akosha. To take your candidature further, kindly reply to this email with an answer to the following question:

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 findmaxdinosaur (int[] years);

Java : public int findMaxdinosaur (int[] years);

Please reply to the above question before Monday 4th February 10 AM. If we don't receive a reply from you, you may consider your application rejected.

changed March 29, 2014