Infosys Interview Question

make a T maximum times with given cards.