From 4756df67704006b42077778190728a19df97bcdc Mon Sep 17 00:00:00 2001 From: Yoepee Date: Tue, 8 Jul 2025 02:31:20 +0900 Subject: [PATCH 1/2] feat:PG_42576 --- .github/pull_request_template.md | 18 ++++++++++++ .idea/misc.xml | 2 +- src/week01/Yoepee/BOJ_1000.java | 4 --- src/week01/Yoepee/PG_120802.java | 4 --- src/week01/Yoepee/PG_42576.java | 50 ++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 .github/pull_request_template.md delete mode 100644 src/week01/Yoepee/BOJ_1000.java delete mode 100644 src/week01/Yoepee/PG_120802.java create mode 100644 src/week01/Yoepee/PG_42576.java diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..3785188 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,18 @@ +# ๐Ÿ“Œ ๋ฌธ์ œ ๋งํฌ +(๋ฌธ์ œ ๋งํฌ ๋˜๋Š” ๋ฌธ์ œ ์บก์ฒ˜๋ณธ์„ ์ฒจ๋ถ€ํ•ด์ฃผ์„ธ์š”.) + + +--- + +## ๐Ÿ“ ๋ฌธ์ œ ๊ฐœ์š” +- + +--- + +## ๐Ÿงฉ ํ’€์ด ๊ณผ์ • ์š”์•ฝ +- + +--- + +## ๐Ÿ˜ ๊ฒฐ๊ณผ +(๋ฌธ์ œ ํ•ด๊ฒฐ ๊ฒฐ๊ณผ๋ฅผ ์ฒจ๋ถ€ํ•ด์ฃผ์„ธ์š”.) \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index ea71d50..37813b7 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/week01/Yoepee/BOJ_1000.java b/src/week01/Yoepee/BOJ_1000.java deleted file mode 100644 index 2a360f4..0000000 --- a/src/week01/Yoepee/BOJ_1000.java +++ /dev/null @@ -1,4 +0,0 @@ -package week01.Yoepee; - -public class BOJ_1000 { -} diff --git a/src/week01/Yoepee/PG_120802.java b/src/week01/Yoepee/PG_120802.java deleted file mode 100644 index 04b35db..0000000 --- a/src/week01/Yoepee/PG_120802.java +++ /dev/null @@ -1,4 +0,0 @@ -package week01.Yoepee; - -public class PG_120802 { -} diff --git a/src/week01/Yoepee/PG_42576.java b/src/week01/Yoepee/PG_42576.java new file mode 100644 index 0000000..2398e92 --- /dev/null +++ b/src/week01/Yoepee/PG_42576.java @@ -0,0 +1,50 @@ +package week01.Yoepee; + +import java.util.*; + +public class PG_42576 { + public static String solution(String[] participant, String[] completion) { + String answer = ""; + Arrays.sort(participant); + Arrays.sort(completion); + for(int i =0; i map = new HashMap<>(); + for(int i =0; i Math.max(v1,v2)+1); + } + for(int i =0; i v1-1); + } + for(int i =0; i Date: Mon, 14 Jul 2025 22:18:42 +0900 Subject: [PATCH 2/2] feat:PG_84512 --- src/week01/Yoepee/PG_84512.java | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/week01/Yoepee/PG_84512.java diff --git a/src/week01/Yoepee/PG_84512.java b/src/week01/Yoepee/PG_84512.java new file mode 100644 index 0000000..cbf2eb1 --- /dev/null +++ b/src/week01/Yoepee/PG_84512.java @@ -0,0 +1,51 @@ +package week01.Yoepee; + +import java.util.*; + +public class PG_84512 { + // ๋งŒ๋“ค์–ด์งˆ ์ˆ˜ ์žˆ๋Š” ์ตœ๋Œ€ ๋‹จ์–ด ๊ธธ์ด + static int MAX_LENGTH = 5; + // ๋ชจ์Œ ์‚ฌ์ „ ๋งŒ๋“ค์–ด์ง€๋Š” ๋ชฉ๋ก + // ๋นˆ๋ฌธ์ž ๊ณ ๋ คํ•ด์„œ index ๊ณ„์‚ฐํ•˜๋ ค๊ณ  "" ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ์ถ”๊ฐ€ + static List list = new ArrayList<>(Arrays.asList("")); + // ์•ŒํŒŒ๋ฒณ ๋ชจ์Œ ๋ฐฐ์—ด + static char[] v = "AEIOU".toCharArray(); + + // ์™„์ „ํƒ์ƒ‰์„ ํ†ตํ•ด ๋ชจ์Œ์‚ฌ์ „ ์ˆœํšŒ + public static void backtrack(StringBuffer path,int depth, String target){ + // ์ตœ๋Œ€ ๊ธ€์ž์ˆ˜๋ฅผ ์ดˆ๊ณผํ•˜๋ฉด ์ข…๋ฃŒ + if(depth > MAX_LENGTH) return; + + String current = path.toString(); + // ๋‹จ์–ด์˜ ๊ธธ์ด๊ฐ€ 1 ์ด์ƒ์ด๋ฉด ์ €์žฅ + if (depth >= 1) list.add(current); + // ํ˜„์žฌ ๋‹จ์–ด๊ฐ€ ์ฃผ์–ด์ง„ ๋‹จ์–ด๋ผ๋ฉด ์ˆœํšŒ ์ข…๋ฃŒ + if (current.equals(target)) return; + + for (char c: v){ + // ์ƒˆ๋กœ์šด ๋ชจ์Œ ์ถ”๊ฐ€ + path.append(c); + // ์‹ ๊ทœ ๋ชจ์Œ ๊ธฐ์ค€์œผ๋กœ ๋ชจ์Œ์‚ฌ์ „ ์žฌ๊ท€ + backtrack(path, depth+1, target); + // ๊ธฐ์กด ๊ฐ’์œผ๋กœ ์ดˆ๊ธฐํ™” ์‹œ์ผœ์•ผ์ง€ sb๊ฐ€ ์ œ๋Œ€๋กœ ๋™์ž‘ํ•จ + path.deleteCharAt(depth); + } + } + + public static int solution(String word) { + StringBuffer sb = new StringBuffer(""); + backtrack(sb, 0, word); + + int answer = list.indexOf(word); + return answer; + } + + public static void main(String[] args) { + // ๊ธฐ๋Œ“๊ฐ’ : 6 + System.out.println(solution("AAAAE")); + // ๊ธฐ๋Œ“๊ฐ’ : 10 + System.out.println(solution("AAAE")); + // ๊ธฐ๋Œ“๊ฐ’ : 1189 + System.out.println(solution("EIO")); + } +}