Amazon Interview Question

OA questions, based on dynamic programming and heaps