i am not able to understand the problem statement of this question. please help me out.
Playing cards problem statement
@ankit152 Hey ankit
Consider the input is :
5 1
3 4 7 6 5
In this input Q is 1 so ther is only 1 iteration. Now there are three stacks intially:
A0 - [3, 4,7, 6, 5]
A1 - []
B1 - []
In first iteration we will look in stack A(iteration - 1) i.e. A0 and check whether the number is divisible by iteration th prime number i.e. 1st prime number i.e. 2 and if it is divisible then we add it in B(iteration) i.e. B1 stack else A(iteration) i.e. A1 stack. SO after first iteration the three stacks will look like this:
A0 - []
A1 - [5, 7, 3]
B1 - [6, 4]
Now since the Q is so we will not iterate further and print the B1,…,BQ, and AQ stack. Therefore, we first print B1 from top to bottom then A1 from top to bottom and hence the result:
4
6
3
7
5
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.