이번 문제는 다른 문제보다 훨씬 더 쉽게 느껴졌다. 바탕화면 분석 : 먼저, 주어진 wallpaper 배열을 순회하며 파일이 위치한 가장 왼쪽, 오른쪽, 위, 아래 지점을 찾는다. 좌표사용 : 이렇게 찾은 좌표를 이용해 드래그의 시작점과 끝점을 결정한다. class Solution { public int[] solution(String[] wallpaper) { int[] answer = new int[4]; int top = 51; int bottom = 0; int left = 51; int right = 0; for(int i = 0; i < wallpaper.length; i++) { for(int j = 0; j < wallpaper[0].length(); j++) { if(wallpaper[i..
프로그래머스 - 바탕화면
이번 문제는 다른 문제보다 훨씬 더 쉽게 느껴졌다. 바탕화면 분석 : 먼저, 주어진 wallpaper 배열을 순회하며 파일이 위치한 가장 왼쪽, 오른쪽, 위, 아래 지점을 찾는다. 좌표사용 : 이렇게 찾은 좌표를 이용해 드래그의 시작점과 끝점을 결정한다. class Solution { public int[] solution(String[] wallpaper) { int[] answer = new int[4]; int top = 51; int bottom = 0; int left = 51; int right = 0; for(int i = 0; i < wallpaper.length; i++) { for(int j = 0; j < wallpaper[0].length(); j++) { if(wallpaper[i..
2024.04.01