Problem Statement | |||||||||||||
At the carnival this year, there is a contest to determine the best surname. One lucky winner will receive a prize. Each surname is assigned a score which is the sum of the ASCII values of all its characters. You will be given a String[] surnames, where each element contains only uppercase letters ('A'-'Z'). Return the 0-based index of the surname in surnames with the highest score. In case of a tie, return the one with the lowest index. The ASCII values for uppercase letters are 'A' = 65, 'B' = 66, ..., 'Z' = 90 (which are the integer values of the characters). | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | surnames will contain between 1 and 10 elements, inclusive. | ||||||||||||
- | Each element of surnames will contain between 1 and 20 characters, inclusive. | ||||||||||||
- | surnames will contain only uppercase letters ('A'-'Z'). | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|