solution to plank cutting interview question