일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 선택정렬
- 알고리즘
- 문자열함수
- kafkaconsumer
- git
- 코딩테스트
- 시스템프로그래밍
- 코테
- IT
- Django
- 자료구조
- 트러블슈팅
- kafka
- java
- SpringSecurity
- 자바
- github
- 백준
- 회고록
- jwt
- 문자열압축
- testcode
- codingtest
- 한이음
- 협업도구
- 기록
- c
- AWS
- 공부기록
- 기술블로그
- Today
- Total
목록CodingTest (33)
신뇽이 되어보자

문제 과정초기 아이디어 R과 B의 수를 세어서 많은 수를 가진 색으로 한번 쭉 덮고 적은 수의 색을 세어주는 방식(연속되는 부분은 한번만 카운트)으로 생각을 하고 구현을 했다. 근데 계속 틀렸다는 결과만 나왔다. 틀린 이유R과 B의 수를 기준으로 둘게 아니라R의 묶음 수와 B의 묶음 수를 비교해서 묶음이 더 많은 색상으로 한번 쭉 칠하는 방식으로 풀었어야 했다. 최종코드import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main { //블로그2 static int N; static char[] m..

내 코드class Solution { public int[] solution(String[] park, String[] routes) { int[] answer = {}; int len = park[0].length(); // 가로 길이 int hlen = park.length; // 세로 길이 char[][] temp = new char[hlen][len]; int startn1 = 0; int startn2 = 0; //시작점을 찾기 for (int i = 0; i = hlen || tempn2 = len || temp[tempn1][tempn2] == 'X') { is..

내 코드 class Solution { public int solution(int n, int w, int num) { int answer = 0; int cnt = 1; int rr = 0; int dd = 0; // 행의 개수를 정확하게 계산 int rows = (n % w == 0) ? (n / w) : (n / w) + 1; int [][]arr = new int[rows][w]; //n: 택배 상자의 개수를 나타내는 정수 //w: 가로로 놓는 상자의 개수 for(int i = 0; i = 0; j--){ arr[i][..

내 코드class Solution { public String solution(String code) { StringBuilder sb = new StringBuilder(); String answer = ""; int mode = 0; for(int i = 0; i 알게 된 점 ret가 빈 문자열일 때 나는 if(answer.equals(""))라고 조건문을 만들었었는데sb의 길이가 0일때로 조건을 걸어주는게 훨씬 더 좋은 방법이었다. https://school.programmers.co.kr/learn/courses/30/lessons/181932 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solu..

내 코드import java.util.*;class Solution { public int[] solution(int l, int r) { int[] answer = {}; int flag = 0; List list = new ArrayList(); for(int i = l ; i 알게 된 점 정수를 String으로 바꿔줄 때 .toString()말고String.valueOf()를 사용해서 해야한다. 맨날 잊어버리는 것 같다 잊지 말자. 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr

https://school.programmers.co.kr/learn/courses/30/lessons/43163 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krbfs문제이고, 무한 방문을 막기 위해 visited 배열을 만들어주고,하나의 문자만 다를 경우에만 큐에 삽입할 수 있으므로, convert함수를 따로 만들어줬다. import java.util.*;class Solution { public int solution(String begin, String target, String[] words) { int answer = 0; Queue queue = new Link..