Given a sequence of integers `arr` of length `n`, rearrange the elements such that the first element is placed at the beginning, the last element is placed next, the second element is placed after that, and the second last element is placed next, and so on. The rearranged sequence should be returned as the result.
Explanation: Alternating elements and placing the second half at the end
Explanation: Alternating elements and maintaining the order
Analyze constraints and compute optimal solutions step-by-step.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak