leetle

Daily challenge for 2025-02-28

59. Counting Inversions

Write a function solve that counts the number of inversions in an array. An inversion is a pair of elements that are out of order.

Example:
Input: [2,4,1,3,5]
Output: 3
Explanation: (2,1), (4,1), (4,3)

Run this challenge interactively in Python or JavaScript when the app loads.