Wise Interview Question

hackerrank type question involving data structures