0881._Boats_to_Save_People
881. Boats to Save People
难度: Medium
刷题内容
原题连接
内容描述
1 | The i-th person has weight people[i], and each boat can carry a maximum weight of limit. |
解题方案
思路 1
**- 时间复杂度: O(N logN)**- 空间复杂度: O(N)**
- 使用贪心算法,将数组进行排序之后进行处理
代码:
1 | /** |
难度: Medium
原题连接
内容描述
1 | The i-th person has weight people[i], and each boat can carry a maximum weight of limit. |
思路 1
**- 时间复杂度: O(N logN)**- 空间复杂度: O(N)**
代码:
1 | /** |