so i was solving this question from searching and sorting section of cses. it took me a hour to solve it through 2 pointers. But i was wondering what would be the approach to solve if the gondola can contain 3 children instead of 2. And what if the limit was 4 children? do these type of questions have some same approach? Can someone please help me???
It's the bin packing problem.