Most Races Won
mine lists the speeds of your horses and theirs the speeds of a rival's horses; both lists have the same length. The horses race in pairs: every horse, yours and theirs, runs in exactly one race, and you decide which of your horses meets which of theirs. You win a race only when your horse is strictly faster. Return the largest number of races you can win.
Example 1
mine [5,3,8]
theirs [4,6,2]
returns 3
Send 3 against 2, 5 against 4 and 8 against 6: all three races are won.
Example 2
mine [1,2,3]
theirs [3,3,3]
returns 0
None of your horses is faster than 3, so no race can be won.
Constraints
1 <= len(mine) == len(theirs) <= 1001 <= mine[i], theirs[i] <= 1000
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.