LC 3479 - Fruits Into Baskets III
[translate by ChatGPT] This problem felt similar to the first one, but I misunderstood the problem statement at the beginning. I also feel that the description of the problem wasn’t very clear. Even toward the end I still wasn’t completely sure what the problem was trying to say. Even when I tried to solve it based on my interpretation, I still couldn’t come up with a solution. Later I saw that the official solution uses a segment tree, and only then did I understand the intended approach. At first I didn’t quite understand it, but eventually I figured out what the data structure is doing. ...