Book Allocation Problem Leetcode Python Solutions