Amazon Coding Question : Cut and Add