Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use bruteforce.
You can use a nested loop to compare each pair of indices <code>(i, j)</code> and check if the conditions are satisfied.
Solve with full IDE support and test cases