Expedia Interview Report
- 0of 0 votes
AnswersGiven a string, print the character which appears the maximum number of times in the string.
- kumar.prince6 February 20, 2014 in United States
The string will contain only ascii characters. If there is a tie in the maximum number
of times a character appears in the string, print the character which appears first in the string.
Notes:
1. The length of the string will be between 1 and 10000, inclusive.
2. Make sure you don't print anything other than a single character in the function. Otherwise, your solution will be marked wrong.
3. You only need to complete the function printMaximumOccurringCharacter.
Sample Input #00
helloworld
Sample Output #00
l
Sample Input #01
aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
Sample Output #01
a
Sample Input #02
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
Sample Output #02
a
4.| Report Duplicate | Flag | PURGE
Expedia Developer Program Engineer Algorithm - 0of 0 votes
Answers.There is an infinite integer grid at which N people have their houses on. They decide to unite at
- kumar.prince6 February 20, 2014 in United States
a common meeting place, which is someone's house.
From any given cell, all 8 adjacent cells are reachable in 1 unit of time.
eg: (x,y) can be reached from (x-1,y+1) in a single unit of time.
Find a common meeting place which minimises the sum of the travel times of all the persons.
Input Format:
N
The following N lines will contain two integers saying the x & y coordinate of the i-th person.
Output Format:
M M = min sum of all travel times;
Constraints:
N <= 10^5
The absolute value of each co-ordinate in the input will be atmost 109
HINT: Please use long long 64-bit integers;
Input #00:
4
0 1
2 5
3 1
4 0
Output #00:
8
Explanation: Sums of travel times of the houses are 11, 13, 8 and 10. 8 is the minimum.
Input #01:
6
12 -14
-3 3
-14 7
-14 -3
2 -12
-1 -6
Output #01:| Report Duplicate | Flag | PURGE
Expedia Developer Program Engineer Algorithm