
If the number of questions is ‘5’ and ‘K’ = 3
Then the order will be
“4 3 5 2 1”
The first line of input contains an integer 'T' representing the number of test cases.
The first line of each test case contains two space-separated integers, ‘N’ and ‘K’, denoting the number of questions and number of questions that he wants to skip.
For each test case, return the order of the questions separated by space.
The output of each test case will be printed in a separate line.
1 <= T <= 5
1 <= N, K <= 3000
Where ‘T’ is the number of test cases, ‘N’ is the number of questions, and ‘K’ is the number of questions that Ninja will skip after solving one question.
Time limit: 1 second.
You do not need to print anything. It has already been taken care of. Just implement the given function.
The idea here is to remove the Kth element from the array. We need two operations to achieve this task, i.e. find the Kth element and delete that element, here we will do this by storing all numbers 1 to N in an array and then remove the Kth element.
Algorithm:
The idea here is to use a policy-based data structure(PBDS), which you can read here. These data structures are designed for high-performance, flexibility, semantic safety, and conformance to the corresponding containers in std.
In this approach, we are going to optimise the previous approach using this data structure.
Using this DS, we can find the kth element and removal of element is done in logarithmic complexity.
Algorithm:
Pair Product Div by K
Pair Product Div by K
Merge Two Sorted Arrays Without Extra Space
Merge Two Sorted Arrays Without Extra Space
Co-Prime
First Digit One
Special Digit Numbers