Bright Data Interview Question

It was a LeetCode-style task about array transformation