Dataroid interview question

Algorithm Questions on hackerrank 2 questions