LeetCode
Erect the Fence
Click
here
for an explanation.