Apple Interview Question

Find and fix a bug in the given codes