A deep-space relay station queues up a sequence of packet values and transmits them once, in order. To protect against a receiver that starts listening a moment late, the relay immediately re-transmits the exact same sequence a second time, back-to-back, with no gap and no reordering. Given the packet values as they appear during a single transmission, determine the full sequence of values a receiver would see across both back-to-back transmissions.
n — the number of packets in one transmission.n space-separated integers — the packet values, in transmission order.2 * n space-separated integers: the n packet values in transmission order, followed immediately by the same n values in the same order again.Example 1
Input
4 1 3 2 1
Expected
1 3 2 1 1 3 2 1
Explanation
The transmission is [1, 3, 2, 1]. The relay repeats this exact sequence immediately afterward, so the receiver sees [1, 3, 2, 1] followed by [1, 3, 2, 1] again, giving 1 3 2 1 1 3 2 1.
Example 2
Input
1 5
Expected
5 5
Explanation
With only one packet, value 5, the relay sends it once and then repeats it once more, so the receiver sees 5 5.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →