Page Allocation Problem Leetcode Two