Dexian Interview Question

Good efficiency and may be little improvement