We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a9db67 commit 29412beCopy full SHA for 29412be
src/main/java/com/fishercoder/solutions/_881.java
@@ -0,0 +1,26 @@
1
+package com.fishercoder.solutions;
2
+
3
+public class _881 {
4
+ public static class Solution1 {
5
+ public int numRescueBoats(int[] people, int limit) {
6
+ Arrays.sort(people);
7
+ int end = people.length - 1;
8
+ int start = 0;
9
+ int boatcount = 0;
10
+ while (end >= start) {
11
+ if (people[end] == limit) {
12
+ end--;
13
+ boatcount++;
14
+ } else if (people[end] + people[start] <= limit) {
15
+ start++;
16
17
18
+ } else {
19
20
21
+ }
22
23
+ return boatcount;
24
25
26
+}
0 commit comments