Amazon Coding Question : Credits