Epic interview question

Some algorithm questions, really hard