
https://www.youtube.com/@ChanSuShin Chan-Su Shin 한국외국어대학교 컴퓨터공학부 신찬수 교수의 강의용 채널로 전체 공개 콘텐츠입니다. (죽어가던 채널을 코로나가 강제로 부활시키는군요.) 주로 자료구조와 알고리즘에 대한 내용을 다루며, www.youtube.com 교수님의 강의를 듣고 정리한 글입니다. 🧙🏻 Quick Select 알고리즘의 단계 k번째로 작은수를 찾아야 하는 상황에서, 후보군의 수 중에서 하나를 임의로 골라 피봇이라고 칭한다. (이하 p) 후보를 하나씩 p와 비교하여 작으면 S, 같으면 M, 크면 L 배열에 넣는다. S 의 크기가 k보다 작으면 S, k가 S와 M의 크기를 더한 것보다 크면 L 에 k번째로 작은 수가 위치한 것이다. 앞선 두 상황에 모두..
😖 틀린 코드 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String input = sc.nextLine(); Stack s = new Stack(); List cnts = new ArrayList(); // 각 괄호의 레이저의 개수 int result = 0; int cnt = 0; // 레이저의 개수 int idx = 0; // ( 등장할 때마다 카운트 하나씩 올리고 ) 나올 때마다 하나씩 내리기 boolean isLaser = false; for(int i=0; i
😖 틀린 풀이 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int c = sc.nextInt(); // 적어도 늘려야 하는 고객의 수 int n = sc.nextInt(); // 홍보를 할 수 있는 도시의 개수 int[] expenses = new int[n]; int[] customers = new int[n]; int[] dp = new int[1001]; for(int i=0; i
😖 틀린 풀이 import java.util.*; class Solution { private int getDifference(int num, int[] B){ int compareDifference = Integer.MAX_VALUE; int index = -1; for(int i=0; i0 && compareDifference>difference){ compareDifference = difference; index = i; } } return index; } public int solution(int[] A, int[] B) { int answer = 0; for(int i=0; i
😖 틀린 풀이 class Solution { private int[][] dp; public void move(int x, int y, int m, int n){ // 갈 수 없는 곳인 경우 if(!in_range(x,y,m,n) || dp[x][y]== -1){ return; } // 도착한 경우 if(x == n && y == m){ return; } dp[x][y]++; // 아래, 오른쪽으로만 움직이는 경우 move(x+1, y, m, n); move(x, y+1, m, n); } public int solution(int m, int n, int[][] puddles) { dp = new int[n][m]; if(puddles[0].length!=0){ for(int i=0;i