diff --git "a/0224LJH/202510/22 PGM \352\265\254\353\252\205\353\263\264\355\212\270.md" "b/0224LJH/202510/22 PGM \352\265\254\353\252\205\353\263\264\355\212\270.md" new file mode 100644 index 00000000..1bc67881 --- /dev/null +++ "b/0224LJH/202510/22 PGM \352\265\254\353\252\205\353\263\264\355\212\270.md" @@ -0,0 +1,32 @@ +```java +import java.io.*; +import java.util.*; + +class Solution { + public int solution(int[] people, int limit) { + + Arrays.sort(people); + System.out.println(people); + int front = 0; + int answer = 0; + int back = people.length-1; + + while (front < back){ + if (people[front]+people[back] <= limit){ + answer++; + people[front++] = 0; + people[back--] = 0; + + + } else{ + back--; + } + } + + for (int n: people){ + if (n != 0) answer++; + } + + return answer; + } +}```