can you provide 1 more test case where Q>1? Question is not quite clear to me.
Playing with cards (in stack)
hello @tasfikrahman007
in this question u are given a stack A0 , and a number q(number of iteration)
now using A0 u need to obtain A1 and B1 (procedure explained in problem)
now using A1 u need to obtain A2 and B2
now using A2 u need to obtain A3 and B3
now using A3 u need to obtain A4 and B4
…
…
…
now using Aq-1 u need to obtain Aq and Bq
at the end u need to print content of B1 ,B2,B3,…Bq , Aq
now try above explanation on this->
