LeetCode
Beautiful Arrangement
Click
here
for an explanation.