Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort the array.
For every index do a binary search to get the possible right end of the window and calculate the possible answer.
Solve with full IDE support and test cases