Infosys interview question

make a T maximum times with given cards.