Inspirock interview question

Questions on arrays and trees in the hackerrank test,