Amazon interview question

OA questions, based on dynamic programming and heaps