Test Case Error

Test case 1 and 2 are showing wrong answers.

Hello @guptarahul3100,

The mistakes in your code:

  1. Read the question properly:
    Each card has a number written on it. Then there will be Q iterations. In ith iteration, you start picking up the cards in Ai-1th pile from the top one by one and check whether the number written on the card is divisible by the ith prime number.
    Problem:
    You are checking divisibility by i+1, which is wrong.

  2. Following code will change the order of elements in A0
    while(!A1.empty())
    {
    A0.push(A1.top());
    A1.pop();
    }
    Problem:
    The top of A1 will become bottom-most element of the A1.

Correct it.
Hope, this would help.
Give a like if you are satisfied.