LeetCode Solution, Medium, 881. Boats to Save People