Book Allocation Problem Leetcode Practice