Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- 백준
- sql문법
- BOJ
- 10989
- springboot
- DockerDesktop
- 파이썬
- 배열
- 3273
- 코딩자격증
- SQL
- 수정렬하기3
- 알고리즘
- fastcampus
- intelij
- 프로그래머스
- 개발포트폴리오
- 소금폭탄
- 패스트캠퍼스후기
- 노션
- 자바스크립트
- java11
- 자바
- 스프링부트시작
- 코테
- java
- 코딩교육
- 패스트캠퍼스
- 코딩테스트
- 패캠
Archives
- Today
- Total
기록용 블로그
[프로그래머스][LV1] 바탕화면 정리 본문
https://school.programmers.co.kr/learn/courses/30/lessons/161990
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
숫자 갱신
package 프로그래머스.LV1;
public class pg3 {
public static int[] solution(String[] wallpaper) {
int lux = Integer.MAX_VALUE;
int luy = Integer.MAX_VALUE;
int rdx = Integer.MIN_VALUE;
int rdy = Integer.MIN_VALUE;
int wallpaperHeight = wallpaper.length;
int wallpaperWidth = wallpaper[0].length();
for(int i=0; i<wallpaperHeight; i++){
for(int j=0; j<wallpaperWidth; j++){
if(wallpaper[i].charAt(j) == '#'){
lux = Math.min(lux,i);
luy = Math.min(luy,j);
rdx = Math.max(rdx,i);
rdy = Math.max(rdy,j);
}
}
}
return new int[]{lux,luy,rdx+1,rdy+1};
}
public static void main(String args[]){
String[] example = {".##...##.", "#..#.#..#", "#...#...#", ".#.....#.", "..#...#..", "...#.#...", "....#...."};
int[] sol = solution(example);
for(int i=0;i<sol.length;i++){
System.out.println(sol[i]);
}
}
}'개발 > 알고리즘 공부' 카테고리의 다른 글
| [알고리즘] 시간복잡도 (0) | 2023.04.20 |
|---|---|
| [프로그래머스][LV1] 덧칠하기 (0) | 2023.04.06 |
| [프로그래머스][LV1] 공원 산책 (0) | 2023.04.05 |
| [BOJ1919] 애너그램 만들기 (0) | 2023.04.05 |
| [boj13223] 소금폭탄 (0) | 2023.04.05 |