Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use Range Queries Data Structures to optimize the algorithm
Solve with full IDE support and test cases