n windows open on a screen, numbered 1 to n. The list windows gives their order from top to bottom: the first one is on top, the last one at the very bottom.
The user clicks on the windows listed in clicks, one after another. A click brings that window to the very top, while the other windows keep their relative order.
Return the order of the windows from top to bottom after all the clicks.windows=[2, 1, 3], clicks=[3, 2, 3] → [3, 2, 1]
[2, 1, 3] → raise 3: [3, 2, 1] → raise 2: [2, 3, 1] → raise 3: [3, 2, 1].
windows=[4, 2, 1, 3], clicks=[4] → [4, 2, 1, 3]
Window 4 is already on top, so nothing changes.
windows=[1, 2, 3, 4, 5], clicks=[5, 1, 4] → [4, 1, 5, 2, 3]
windows is a permutation of 1 to nwindows=[2, 1, 3], clicks=[3, 2, 3]
[3, 2, 1]
Run checks the first 3 tests in your browser. Submit checks all 78 tests on the server, hidden ones included.