Domanda di colloquio di Amazon

Segment tree - LeetCode medium Asked to code brute force first and then the optimised solution.