Bright Data interview question

It was a LeetCode-style task about array transformation