IBM interview question

Counting Tickets questions from hackerrank.