Book Allocation Problem Leetcode Practice Sql