Bloomberg Interview Question

the brain teaser, and the program correctness problem