목록프로그래머스/프로그래머스 LV.0 (19)
밍쎄의 코딩공간
class Solution { public String[] solution(String[] quiz) { String[] answer = new String[quiz.length]; for(int i = 0; i < quiz.length; i++){ String[] tmp = quiz[i].split(" "); int a = Integer.parseInt(tmp[0]); int b = Integer.parseInt(tmp[2]); int c = Integer.parseInt(tmp[4]); int d = 0; char op = tmp[1].charAt(0); switch(op){ case '+': d = a + b; break; case '-': d = a - b; break; } if(c == d) a..
import java.util.*; class Solution { public int[] solution(int[] arr, int[] delete_list) { ArrayList tmp = new ArrayList(); HashSet set = new HashSet(); for(int x : delete_list) set.add(x); for(int x : arr){ if(!set.contains(x)) tmp.add(x); } int[] answer = new int[tmp.size()]; for(int i = 0; i < tmp.size(); i++) answer[i] = tmp.get(i); return answer; } } https://school.programmers.co.kr/learn/c..
class Solution { public int[][] solution(int n) { int[][] answer = new int[n][n]; int[] dx = {-1, 0, 1, 0}; int[] dy = {0, 1, 0, -1}; int x = 0, y = 0, d = 1; int k = n * n; int cnt = 1; while(cnt = n || ny = n || answer[nx][ny] > 0) { d = (d + 1) % 4; continue; } answer[x][y] = cnt; cnt++; x = nx; y = ny; } answer[x][y] =..
import java.util.*; class Solution { public int solution(int[] rank, boolean[] attendance) { int answer = 0; ArrayList al = new ArrayList(); for(int i = 0; i a[0] - b[0]); answer += al.get(0)[1] * 10000; answer += al.get(1)[1] * 100; answer += al.get(2)[1]; return answer; } } https://school.programmers.c..
import java.util.*; class Solution { public int[] solution(String myString) { ArrayList al = new ArrayList(); int cnt = 0; for(char c : myString.toCharArray()){ if(c == 'x'){ al.add(cnt); cnt = 0; } else cnt++; } al.add(cnt); int[] answer = new int[al.size()]; for(int i = 0; i < al.size(); i++){ answer[i] = al.get(i); } return answer; } } https://school.programmers.co.kr/learn/courses/30/lessons..
Trie와 관련된 문제를 찾던 중에 카카오 블라인드 문제를 접하게되었다. 이번 내 부캠에서 본 코테에 대하여 멤버들과 이야기를 해봤는데 String startwith등 내장 메서드를 이용하셨다고 하셨다. 공부를 하면할 수록 점점 더 처음으로 돌아가는 것 같다...!! 흐흐 궁굼해서 다른 분의 코테를 참고하였다! https://wellbell.tistory.com/166 프로그래머스 - 자동완성 문제 (자바) programmers.co.kr/learn/courses/30/lessons/17685 코딩테스트 연습 - [3차] 자동완성 자동완성 포털 다음에서 검색어 자동완성 기능을 넣고 싶은 라이언은 한 번 입력된 문자열을 학습해서 다음 입력 때 활용 wellbell.tistory.com 첫 번째 방법은 문자..