Need to add logic to handle n < 10.
Need to add logic to handle n < 10.