In general, you can use this algorithm:
- Create a hash table that maps the year to the number of occurrences.
- For each number in your array, put the corresponding entry in the hash table.
- When done, get the number of entries in the hash.
"". , , . , 0-3000 . , - . 0s. , 2009 , arr [2009]. arr [i] >= 1.