Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 750 Bytes

File metadata and controls

46 lines (37 loc) · 750 Bytes

NPTEL-Programming-Assignment-T1-Q1

NPTEL Programming Assignment: T1-Q1

T1-Q1

You are given a sequence of positive integers, terminated with a -1. (The -1 is not part of the sequence.) There will be at most 100 positive numbers in the sequence.

You have to output the number which occurs the most number of times in the sequence. In case there are multiple numbers with the same number of occurrences, output the minimum such number.

Sample input 1

11 3 1 2 4 -1

Sample output 1

1

Sample input 2

1 23 1 1 1 1 -1

Sample output 2

1

Sample input 3

65 99 33 22 22 99 -1

Sample output 3

22

Sample input 4

7 5 6 6 7 7 7 7 77 7 -1

Sample output 4

7