Amazon Interview Question

some coding question involving arrays