Book Allocation Leetcode Problem 643