
3일차 문제
링크 : https://school.programmers.co.kr/learn/courses/30/lessons/161990
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
문제 풀이
class Solution {
public int[] solution(String[] wallpaper) {
int[] answer = {50, 50, 0, 0};
for(int i=0; i<wallpaper.length; i++) {
for(int j=0; j<wallpaper[0].length(); j++) {
if(wallpaper[i].charAt(j) == '#') {
answer[0] = Math.min(answer[0], i);
answer[1] = Math.min(answer[1], j);
answer[2] = Math.max(answer[2], i+1);
answer[3] = Math.max(answer[3], j+1);
}
}
}
return answer;
}
}'Study > 99클럽 코테 스터디' 카테고리의 다른 글
| [99클럽 코테 스터디 6일차 TIL] 섬의 개수 (0) | 2025.04.07 |
|---|---|
| [99클럽 코테 스터디 5일차 TIL] 수열 (0) | 2025.04.04 |
| [99클럽 코테 스터디 4일차 TIL] 안전 영역 (0) | 2025.04.03 |
| [99클럽 코테 스터디 2일차 TIL] 피보나치 비스무리한 수열 (0) | 2025.04.01 |
| [99클럽 코테 스터디 1일차 TIL] 소수 구하기 (2) | 2025.03.31 |