Amazon Interview Question

Similar to the course schedule question on leetcode.