two of the test case is giving wrong answer
Playing with cards stack
@avinashmallik2017 for input
5 2
3 4 7 6 5
Your code is giving output
34657 but it should be
46357
You are not printing in order b1,b2,…bn,an
two of the test case is giving wrong answer
@avinashmallik2017 for input
5 2
3 4 7 6 5
Your code is giving output
34657 but it should be
46357
You are not printing in order b1,b2,…bn,an