Amazon Interview Question

Basic C code algorithm, need to write it down, not typing