Sponsored
Use these hints if you're stuck. Try solving on your own first.
How can we use precalculation to efficiently calculate the average difference at an index?
Create a prefix and/or suffix sum array.
Solve with full IDE support and test cases