본문 바로가기

codingtest242

[Programmers] Lv.1 | 유연근무제 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/388351 풀이class Solution { public int solution(int[] schedules, int[][] timelogs, int startday) { int n = schedules.length; // 직원 수 int answer = 0; // 상품 받을 직원 수 for (int i = 0; i = 60) { limitH += 1; limitM -= 60; } // 최종 인정 시간: 시*100 + 분 in.. 2025. 11. 6.
[Programmers] Lv.1 | 택배 상자 꺼내기 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/389478 풀이class Solution { public int solution(int n, int w, int num) { // 상자는 번호가 1번부터 시작하지만, 컴퓨터는 0부터 세기 때문에 // 계산하기 편하게 num - 1을 해줌 // 예: 1번 상자는 0번째로, 7번 상자는 6번째로 생각 int floor = (num - 1) / w; // num이 몇 번째 층(0층부터)에 있는지 int pos = (num - 1) % w; // 그 층 안에서 왼쪽부터 몇 번째 칸인지 (0부터 시작) // 층의 쌓이는.. 2025. 11. 6.
[Programmers] Lv.0 | 중복된 숫자 개수 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/120583 풀이import java.util.*;class Solution { public int solution(int[] array, int n) { int count = 0; for (int num : array) { if (num == n) { count++; } } return count; }}import java.util.*;class Solution { public int solution(int[] array, int n) {.. 2025. 11. 6.
[Programmers] Lv.0 | 머쓱이보다 키 큰 사람 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/120585 풀이class Solution { public int solution(int[] array, int height) { int count = 0; for (int h : array) { if (h > height) { count++; } } return count; }}import java.util.*;class Solution { public int solution(int[] array, int height) { r.. 2025. 11. 6.
[Programmers] Lv.0 | 두 수의 합 구하기 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/120802 풀이class Solution { public int solution(int num1, int num2) { return num1 + num2; }} 2025. 11. 6.
[Programmers] Lv.0 | 두 수의 차 구하기 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/120803 풀이class Solution { public int solution(int num1, int num2) { return num1 - num2; }} 2025. 11. 6.
[Programmers] Lv.0 | 두 수의 곱 구하기 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/120804 풀이class Solution { public int solution(int num1, int num2) { return num1 * num2; }} 2025. 11. 6.
[Programmers] Lv.0 | [PCCE 기출문제] 8번 / 닉네임 규칙 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/340200 풀이class Solution { public String solution(String nickname) { String answer = ""; for(int i=0; i 8){ answer = answer.substring(0, 8); } return answer; }} 2025. 11. 5.
[Programmers] Lv.0 | [PCCE 기출문제] 7번 / 버스 | Java 문제https://school.programmers.co.kr/learn/courses/30/lessons/340201 풀이class Solution { public int solution(int seat, String[][] passengers) { int num_passenger = 0; for(int i=0; i num){ return 0; } else{ return num; } } public int func2(int num){ if(num > 0){ return 0; } else{ return num; .. 2025. 11. 5.