Skip to content
Onsite

Rank of India in ICPC

EasyP3Coding

countries lists the teams of a contest from the best result to the worst. Return the rank of "India", which is its 1-based position in the list. If "India" is not in the list, return -1.

The comparison is case-sensitive and every country appears at most once.

Example 1

Input
countries = ["USA","India","China"]
Output
2

Example 2

Input
countries = ["India"]
Output
1

Example 3

Input
countries = ["China","Japan","Germany","India"]
Output
4

Constraints

  • 0 <= countries.length <= 10^4
  • Each name is a non-empty string of letters and spaces
  • Names are unique

Hints

Run checks the 3 visible tests, Submit all 10.