Amazon Interview Question

using pointers in codes :P