IBM interview question

valid tokens and minimum total cost