Rank Agreement
Two judges scored the same contestants: a[i] and b[i] are their scores for contestant i. Return the Spearman rank correlation of the two lists: 1 when they order the contestants the same way, -1 when exactly opposite.
Example 1
a [1,2,3]
b [10,20,90]
returns 1.0
Both lists put the contestants in the same order, even though the scores are far apart.
Constraints
3 <= len(a) == len(b) <= 40- Neither list has all scores equal
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More SciPy problems
- Ranks With Shared PlacesEasy
- Solve the SystemEasy
- Value in BetweenEasy
- Are They IndependentMedium
- Break-Even RateMedium
- Cheapest PairingMedium
- Do the Groups DifferMedium
- Fit the DecayMedium