Sponsored
Use these hints if you're stuck. Try solving on your own first.
Brute force for each array element.
In order to improve the time complexity, we can sort the array and get the answer for each array element.
Solve with full IDE support and test cases