365. Remove N-th Node from End
MediumTwo Pointers
Remove the k-th node from the end of the list and print the remaining values, or EMPTY.
Input format
Line 1: n k Line 2: n values
Output format
The list after removal, or EMPTY.
Example 1
Input
5 2 1 2 3 4 5
Output
1 2 3 5
Example 2
Input
1 1 1
Output
EMPTY
Constraints
1 ≤ k ≤ n ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…