Page Allocation Problem Leetcode