본문 바로가기

프로그래머스77

덧칠하기 풀이 class Solution { public int solution(int n, int m, int[] section) { int roller = section[0]; int cnt = 1; for(int i = 1; i < section.length; i++) { if(roller + m - 1 < section[i]) { cnt++; roller = section[i]; } } return cnt; } } 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr
바탕화면 정리 풀이 class Solution { public int[] solution(String[] wallpaper) { int minX = Integer.MAX_VALUE; int minY = Integer.MAX_VALUE; int maxX = Integer.MIN_VALUE; int maxY = Integer.MIN_VALUE; for(int i=0; i< wallpaper.length;i++ ){ for(int j=0; j
공원 산책 풀이 class Solution { public int[] solution(String[] park, String[] routes) { int h = park.length; int w = park[0].length(); int startH = 0; int startW = 0; for(int i=0; i
추억 점수 풀이 class Solution { public int[] solution(String[] name, int[] yearning, String[][] photo) { int[] answer = new int[photo.length]; for(int i=0; i
달리기 경주 풀이 import java.util.*; class Solution { public String[] solution(String[] players, String[] callings) { String[] answer = new String[players.length]; HashMap mappedByPlayer = new HashMap(); HashMap mappedByRank = new HashMap(); // 각각의 맵을 초기화 for (int i = 0; i < players.length; i++) { mappedByPlayer.put(players[i], i); mappedByRank.put(i, players[i]); } for (int i = 0; i < callings.length; i++) {..