자바40 Bubbling과 Capturing Bubbling & Capturing Bubbling => start from child to parent Capturing => start from parent to child Bubbling과 Capturing은 순서가 정 반대인 동작이다. Bubbling은 이벤트가 발생했을때 자신이 속한 parent, 그리고 그 위의 모든 parent까지 이벤트가 발생한다. 여기에 애국가가 있다. 동해물과 백두산이 마르고 닳도록 하느님이 보우하사 우리 나라 만세 무궁화 삼천리 화려강산 parent id를 가진 div태그와 child id를 가진 div태그로 애국가가 감싸져있다. 이를 클릭하였을때 console.log()를 찍어내게 해보자 const parent = document.getElementById('.. 2023. 8. 25. [Lv.2]할인행사 ArrayList을 생성하여 원하는 물품을 갯수에 맞게 담아준다. 투포인터를 활용, int start_point, end_point를 생성해준다. (슬라이딩 윈도우) 반복문을 수행한다. (while문, 종료조건은 end_point가 discount의 길이만큼 되었을 때)3-2. for문을 start_point부터 end_point까지 수행해준다. discount배열을 순회하게된다.3-4. tmp가 비었다면, answer++; 3-5. end_point와 start_point를 ++해준다. 3-3. tmp에 discount가 들어있으면 tmp리스트에서 remove해준다. 3-1. tmp라는 새로운 ArrayList를 생성(1번 단계에서 생성된 ArrayList를 카피한다) package PG.Lv_2; i.. 2023. 3. 9. [Lv.2]N진수 게임 package PG.Lv_2; public class N진수게임 { public static String solution(int n, int t, int m, int p) { String answer = ""; int len = t * m; String number = ""; int idx = 0; while (true) { if (number.length() >= len) { break; } number += Integer.toString(idx, n); idx++; } number = number.toUpperCase(); int order = 1; for (int i = 0; i m) { order = 1; } if (answer... 2023. 3. 3. [Lv.2]피로도 package PG.Lv_2; import java.util.Arrays; public class 피로도 { static int answer = 0; static boolean[] visited; public static int solution(int k, int[][] dungeons) { visited = new boolean[dungeons.length]; dfs(k, dungeons, 0); return answer; } public static void dfs(int k, int[][] dungeons, int depth) { for (int i = 0; i < dungeons.length; i++) { if (!visited[i] && dungeons[i][0] 2023. 3. 3. 이전 1 2 3 4 ··· 10 다음