From a17dbb29b5bc561195cea1b9ba35646fca7591f1 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Thu, 12 Oct 2023 22:07:49 +0900 Subject: [PATCH 01/80] test commit --- Test/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Test/README.md diff --git a/Test/README.md b/Test/README.md new file mode 100644 index 0000000000..7d5a96a066 --- /dev/null +++ b/Test/README.md @@ -0,0 +1,3 @@ +# Git 연결 확인 test +--- +:raised_hand: \ No newline at end of file From 78c1188926345037ca98a95cfdff2caa749d0f41 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Thu, 12 Oct 2023 22:15:04 +0900 Subject: [PATCH 02/80] =?UTF-8?q?=EA=B3=BC=EC=97=B0=20=EC=84=B1=EA=B3=B5?= =?UTF-8?q?=3F=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Test/README.md b/Test/README.md index 7d5a96a066..adcb7763a0 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,3 +1,2 @@ -# Git 연결 확인 test ---- -:raised_hand: \ No newline at end of file +

Hello World

+
this is test to checkout branchgit
\ No newline at end of file From 524555bbde721219f1809d7b66698fe5dfb43892 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:43:22 +0900 Subject: [PATCH 03/80] =?UTF-8?q?=EC=BB=A4=EB=B0=8B=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Test/README.md b/Test/README.md index 7d5a96a066..a555ac76b8 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,3 +1,4 @@ -# Git 연결 확인 test ---- -:raised_hand: \ No newline at end of file +# Git 연결 확인 test2 +- - - +- hellogut +- hi \ No newline at end of file From e3d672d42285f741f91e5319632ededf8d4968c3 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 09:45:46 +0900 Subject: [PATCH 04/80] yangyanghunjung branch test --- src/main/java/onboarding/Problem1.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/onboarding/Problem1.java b/src/main/java/onboarding/Problem1.java index b99e6b5e67..480c094bc9 100644 --- a/src/main/java/onboarding/Problem1.java +++ b/src/main/java/onboarding/Problem1.java @@ -5,6 +5,7 @@ class Problem1 { public static int solution(List pobi, List crong) { int answer = Integer.MAX_VALUE; + //test return answer; } } \ No newline at end of file From 672b92cdf565b1ca02c5d8fec7902d42ea75fc32 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 09:47:17 +0900 Subject: [PATCH 05/80] yangyanghunjung branch test2 --- src/main/java/onboarding/Problem1.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/onboarding/Problem1.java b/src/main/java/onboarding/Problem1.java index 480c094bc9..00651bfd5c 100644 --- a/src/main/java/onboarding/Problem1.java +++ b/src/main/java/onboarding/Problem1.java @@ -6,6 +6,7 @@ class Problem1 { public static int solution(List pobi, List crong) { int answer = Integer.MAX_VALUE; //test + //teset2 return answer; } } \ No newline at end of file From 4ef00082c1b3dc9e4ba3f80bb6bdabcdc320b155 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:43:22 +0900 Subject: [PATCH 06/80] =?UTF-8?q?=EC=BB=A4=EB=B0=8B=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Test/README.md b/Test/README.md index adcb7763a0..a555ac76b8 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,2 +1,4 @@ -

Hello World

-
this is test to checkout branchgit
\ No newline at end of file +# Git 연결 확인 test2 +- - - +- hellogut +- hi \ No newline at end of file From 8d804b27509030a20bb91a9e82af3214e19607e6 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Thu, 12 Oct 2023 22:15:04 +0900 Subject: [PATCH 07/80] =?UTF-8?q?=EA=B3=BC=EC=97=B0=20=EC=84=B1=EA=B3=B5?= =?UTF-8?q?=3F=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Test/README.md b/Test/README.md index a555ac76b8..adcb7763a0 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,4 +1,2 @@ -# Git 연결 확인 test2 -- - - -- hellogut -- hi \ No newline at end of file +

Hello World

+
this is test to checkout branchgit
\ No newline at end of file From 0d8e1b8b78638b1e9ab2d6643cbb61d5375e035e Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Thu, 12 Oct 2023 22:15:04 +0900 Subject: [PATCH 08/80] =?UTF-8?q?=EA=B3=BC=EC=97=B0=20=EC=84=B1=EA=B3=B5?= =?UTF-8?q?=3F=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Test/README.md b/Test/README.md index a555ac76b8..adcb7763a0 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,4 +1,2 @@ -# Git 연결 확인 test2 -- - - -- hellogut -- hi \ No newline at end of file +

Hello World

+
this is test to checkout branchgit
\ No newline at end of file From ffd5ecba18dd2b20791fb7d0343d7d96be998801 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 09:45:46 +0900 Subject: [PATCH 09/80] yangyanghunjung branch test --- src/main/java/onboarding/Problem1.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/onboarding/Problem1.java b/src/main/java/onboarding/Problem1.java index b99e6b5e67..480c094bc9 100644 --- a/src/main/java/onboarding/Problem1.java +++ b/src/main/java/onboarding/Problem1.java @@ -5,6 +5,7 @@ class Problem1 { public static int solution(List pobi, List crong) { int answer = Integer.MAX_VALUE; + //test return answer; } } \ No newline at end of file From 02b926e406ac80756fafcb07a74699c369acb0cf Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 09:47:17 +0900 Subject: [PATCH 10/80] yangyanghunjung branch test2 --- src/main/java/onboarding/Problem1.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/onboarding/Problem1.java b/src/main/java/onboarding/Problem1.java index 480c094bc9..00651bfd5c 100644 --- a/src/main/java/onboarding/Problem1.java +++ b/src/main/java/onboarding/Problem1.java @@ -6,6 +6,7 @@ class Problem1 { public static int solution(List pobi, List crong) { int answer = Integer.MAX_VALUE; //test + //teset2 return answer; } } \ No newline at end of file From b6220c551cbdb62659375ddc28d141fc190faa47 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:43:22 +0900 Subject: [PATCH 11/80] =?UTF-8?q?=EC=BB=A4=EB=B0=8B=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Test/README.md b/Test/README.md index adcb7763a0..a555ac76b8 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,2 +1,4 @@ -

Hello World

-
this is test to checkout branchgit
\ No newline at end of file +# Git 연결 확인 test2 +- - - +- hellogut +- hi \ No newline at end of file From 3478907c722a7b8eb899fbd3c21d16558eaaf3dd Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Thu, 12 Oct 2023 22:15:04 +0900 Subject: [PATCH 12/80] =?UTF-8?q?=EA=B3=BC=EC=97=B0=20=EC=84=B1=EA=B3=B5?= =?UTF-8?q?=3F=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Test/README.md b/Test/README.md index a555ac76b8..adcb7763a0 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,4 +1,2 @@ -# Git 연결 확인 test2 -- - - -- hellogut -- hi \ No newline at end of file +

Hello World

+
this is test to checkout branchgit
\ No newline at end of file From b14bde141003a279c5363019ab584ff77619c57d Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:43:22 +0900 Subject: [PATCH 13/80] =?UTF-8?q?=EC=BB=A4=EB=B0=8B=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Test/README.md b/Test/README.md index adcb7763a0..a555ac76b8 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,2 +1,4 @@ -

Hello World

-
this is test to checkout branchgit
\ No newline at end of file +# Git 연결 확인 test2 +- - - +- hellogut +- hi \ No newline at end of file From 8a647ce9ffbf87a4edf5af716e0c6b372803e619 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:54:12 +0900 Subject: [PATCH 14/80] =?UTF-8?q?Revert=20"=EC=BB=A4=EB=B0=8B=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit afdb9b7f1deb9594739d3e8d9a547140a502f708. --- Test/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Test/README.md b/Test/README.md index a555ac76b8..7d5a96a066 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,4 +1,3 @@ -# Git 연결 확인 test2 -- - - -- hellogut -- hi \ No newline at end of file +# Git 연결 확인 test +--- +:raised_hand: \ No newline at end of file From 21627d61e1da192ab46a92b7d92cde1e9b883fac Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:55:21 +0900 Subject: [PATCH 15/80] =?UTF-8?q?com=20=EC=BB=A4=EB=B0=8B=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Test/README.md b/Test/README.md index 7d5a96a066..2c361a35fd 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,3 +1,4 @@ # Git 연결 확인 test --- -:raised_hand: \ No newline at end of file +:raised_hand: +- 안녕 \ No newline at end of file From f0a51cafc33ea92f54b51314022e7fe0ca5400c7 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 15:22:20 +0900 Subject: [PATCH 16/80] =?UTF-8?q?onbarding=5Fproblem1=20=EC=99=84=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/hi/Compare.java | 12 ++ src/main/java/hi/Page.java | 28 +++ src/main/java/hi/Score.java | 40 ++++ src/main/java/onboarding/Problem1.java | 9 +- src/test/java/onboarding/ApplicationTest.java | 192 +++++++++--------- 5 files changed, 185 insertions(+), 96 deletions(-) create mode 100644 src/main/java/hi/Compare.java create mode 100644 src/main/java/hi/Page.java create mode 100644 src/main/java/hi/Score.java diff --git a/src/main/java/hi/Compare.java b/src/main/java/hi/Compare.java new file mode 100644 index 0000000000..1fd7f31165 --- /dev/null +++ b/src/main/java/hi/Compare.java @@ -0,0 +1,12 @@ +package hi; + +public class Compare { + public int CompareScore(Integer largePobiScore ,Integer largeCrongScore) { + if (largePobiScore < largeCrongScore) { + return 2; + } else if (largePobiScore > largeCrongScore) { + return 1; + } + return 0; + } +} diff --git a/src/main/java/hi/Page.java b/src/main/java/hi/Page.java new file mode 100644 index 0000000000..129d0e4616 --- /dev/null +++ b/src/main/java/hi/Page.java @@ -0,0 +1,28 @@ +package hi; + +import java.util.List; +import hi.Score; + +public class Page { + private static final int MIN = 3; + private static final int MAX =398; + + public int PageValidation (List pobi, List crong) { + int pobiLeft = pobi.get(0); + int pobiRight = pobi.get(1); + int crongLeft = crong.get(0); + int crongRight = crong.get(1); + + if (pobiRight - pobiLeft != 1 || crongRight - crongLeft != 1) { + return -1; + } + if (pobiLeft < MIN || pobiLeft > MAX || crongLeft < MIN || crongLeft > MAX + || pobiRight < MIN || pobiRight > MAX || crongRight < MIN || crongRight > MAX) { + return -1; + } + Score score = new Score(); + int win = score.LargeScore(pobiLeft, pobiRight, crongLeft, crongRight); + + return win; + } +} \ No newline at end of file diff --git a/src/main/java/hi/Score.java b/src/main/java/hi/Score.java new file mode 100644 index 0000000000..ef5c28cfbc --- /dev/null +++ b/src/main/java/hi/Score.java @@ -0,0 +1,40 @@ +package hi; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +public class Score { + public Integer LargeScore(Integer pobiLeft, Integer pobiRight, Integer crongLeft, Integer crongRight) { + + int largePobiScoreLeft = Calculate(pobiLeft); + int largePobiScoreRight = Calculate(pobiRight); + int largeCrongScoreLeft = Calculate(crongLeft); + int largeCrongScoreRight = Calculate(crongRight); + + int largePobiScore = largePobiScoreLeft < largePobiScoreRight ? largePobiScoreRight : largePobiScoreLeft; + int largeCrongScore = largeCrongScoreLeft < largeCrongScoreRight ? largeCrongScoreRight : largeCrongScoreLeft; + + Compare compare = new Compare(); + int win = compare.CompareScore(largePobiScore, largeCrongScore); + + return win; + } + public int Calculate (int score) { + LinkedList scoreLists = new LinkedList<>(); + while (score > 0) { + scoreLists.push(score % 10); + score /= 10; + } + int add = 0; + int mul = 1; + for (int i = 0; i < scoreLists.size(); i++) { + add += scoreLists.get(i); + mul *= scoreLists.get(i); + } + + return add < mul ? mul : add; + } +} + + diff --git a/src/main/java/onboarding/Problem1.java b/src/main/java/onboarding/Problem1.java index 00651bfd5c..b4deee9f4f 100644 --- a/src/main/java/onboarding/Problem1.java +++ b/src/main/java/onboarding/Problem1.java @@ -1,12 +1,13 @@ package onboarding; import java.util.List; +import hi.Page; class Problem1 { public static int solution(List pobi, List crong) { - int answer = Integer.MAX_VALUE; - //test - //teset2 - return answer; + Page page = new Page(); + int score = page.PageValidation(pobi, crong); + System.out.println(score); + return score; } } \ No newline at end of file diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 4cdf3ed0ef..0e8a82599f 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -33,101 +33,109 @@ void case3() { int result = -1; assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); } - } - - @Nested - class Problem2Test { - @Test - void case1() { - String cryptogram = "browoanoommnaon"; - String result = "brown"; - assertThat(Problem2.solution(cryptogram)).isEqualTo(result); - } - - @Test - void case2() { - String cryptogram = "zyelleyz"; - String result = ""; - assertThat(Problem2.solution(cryptogram)).isEqualTo(result); - } - } - - @Nested - class Problem3Test { - @Test - void case1() { - int number = 13; - int result = 4; - assertThat(Problem3.solution(number)).isEqualTo(result); - } - - @Test - void case2() { - int number = 33; - int result = 14; - assertThat(Problem3.solution(number)).isEqualTo(result); - } - } - - @Nested - class Problem4Test { - @Test - void case1() { - String word = "I love you"; - String result = "R olev blf"; - assertThat(Problem4.solution(word)).isEqualTo(result); - } - } - - @Nested - class Problem5Test { - @Test - void case1() { - int money = 50_237; - List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); - assertThat(Problem5.solution(money)).isEqualTo(result); - } @Test - void case2() { - int money = 15_000; - List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); - assertThat(Problem5.solution(money)).isEqualTo(result); - } - } - - @Nested - class Problem6Test { - @Test - void case1() { - List> forms = List.of( - List.of("jm@email.com", "제이엠"), - List.of("jason@email.com", "제이슨"), - List.of("woniee@email.com", "워니"), - List.of("mj@email.com", "엠제이"), - List.of("nowm@email.com", "이제엠") - ); - List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); - assertThat(Problem6.solution(forms)).isEqualTo(result); + void case4() { + List pobi = List.of(1,2); + List crong = List.of(399,400); + int result = -1; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); } } - @Nested - class Problem7Test { - @Test - void case1() { - String user = "mrko"; - List> friends = List.of( - List.of("donut", "andole"), - List.of("donut", "jun"), - List.of("donut", "mrko"), - List.of("shakevan", "andole"), - List.of("shakevan", "jun"), - List.of("shakevan", "mrko") - ); - List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); - List result = List.of("andole", "jun", "bedi"); - assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); - } - } +// @Nested +// class Problem2Test { +// @Test +// void case1() { +// String cryptogram = "browoanoommnaon"; +// String result = "brown"; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// String cryptogram = "zyelleyz"; +// String result = ""; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem3Test { +// @Test +// void case1() { +// int number = 13; +// int result = 4; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// int number = 33; +// int result = 14; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem4Test { +// @Test +// void case1() { +// String word = "I love you"; +// String result = "R olev blf"; +// assertThat(Problem4.solution(word)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem5Test { +// @Test +// void case1() { +// int money = 50_237; +// List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); +// assertThat(Problem5.solution(money)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// int money = 15_000; +// List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); +// assertThat(Problem5.solution(money)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem6Test { +// @Test +// void case1() { +// List> forms = List.of( +// List.of("jm@email.com", "제이엠"), +// List.of("jason@email.com", "제이슨"), +// List.of("woniee@email.com", "워니"), +// List.of("mj@email.com", "엠제이"), +// List.of("nowm@email.com", "이제엠") +// ); +// List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); +// assertThat(Problem6.solution(forms)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem7Test { +// @Test +// void case1() { +// String user = "mrko"; +// List> friends = List.of( +// List.of("donut", "andole"), +// List.of("donut", "jun"), +// List.of("donut", "mrko"), +// List.of("shakevan", "andole"), +// List.of("shakevan", "jun"), +// List.of("shakevan", "mrko") +// ); +// List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); +// List result = List.of("andole", "jun", "bedi"); +// assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); +// } +// } } From 21fb8f0937a78223d989dc56ae1de4ca001cb278 Mon Sep 17 00:00:00 2001 From: yang Date: Mon, 16 Oct 2023 10:36:23 +0900 Subject: [PATCH 17/80] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Problem2/functionList.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/java/Problem2/functionList.md diff --git a/src/main/java/Problem2/functionList.md b/src/main/java/Problem2/functionList.md new file mode 100644 index 0000000000..6d5f33a535 --- /dev/null +++ b/src/main/java/Problem2/functionList.md @@ -0,0 +1,16 @@ +# 🚀 problem2 기능 목록 +- - - +### 1. StringValidation +```java +System.out.println("예외"); +``` +- 글자수가 **1**이하 **1000** 이상일 경우 +- **대문자**가 들어올 경우 +- 빈문자열 값: ```return 빈문자열``` +- - - +### 2. FindAndRemoveDuplicate +- **LinkedList**로 첫 문자부터 순회 +- 반복문자 나올 시 next node **포인터 변경** (삭제) +- 반복이 없다면 다음 node로 이동 +- ```return 최종 문자열``` + \ No newline at end of file From d035f7a2e31a5489e9c79456f5e134d816ce43c5 Mon Sep 17 00:00:00 2001 From: yang Date: Mon, 16 Oct 2023 10:53:04 +0900 Subject: [PATCH 18/80] =?UTF-8?q?StringValidation=20=EA=B8=B0=EB=8A=A5=20c?= =?UTF-8?q?ommit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Problem2/StringValidation.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/java/Problem2/StringValidation.java diff --git a/src/main/java/Problem2/StringValidation.java b/src/main/java/Problem2/StringValidation.java new file mode 100644 index 0000000000..1e4e965312 --- /dev/null +++ b/src/main/java/Problem2/StringValidation.java @@ -0,0 +1,18 @@ +package Problem2; + +public class StringValidation { + public boolean Validate (String cryptogram) { + // 문자열 길이 오류 + if (cryptogram.length() < 1 || cryptogram.length() > 1000) { + return false; + } + // 대문자 포함될 경우 + char[] charArray = cryptogram.toCharArray(); + for (int i = 0; i < charArray.length; i++) { + if (Character.isUpperCase(charArray[i])) { + return false; + } + } + return true; + } +} From 68b06108298e7cfcc635984333146fcc7d91baf5 Mon Sep 17 00:00:00 2001 From: yang Date: Mon, 16 Oct 2023 10:54:34 +0900 Subject: [PATCH 19/80] =?UTF-8?q?FindAndRemoveDuplicate=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Problem2/FindAndRemoveDuplicate.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/java/Problem2/FindAndRemoveDuplicate.java diff --git a/src/main/java/Problem2/FindAndRemoveDuplicate.java b/src/main/java/Problem2/FindAndRemoveDuplicate.java new file mode 100644 index 0000000000..b20b73ae29 --- /dev/null +++ b/src/main/java/Problem2/FindAndRemoveDuplicate.java @@ -0,0 +1,9 @@ +package Problem2; + +public class FindAndRemoveDuplicate { + public String FindAndRemve (String cryptogram) + { + + return ""; + } +} From d6e8ad2970e16bb8ce467c0162b6d13a3d79ce58 Mon Sep 17 00:00:00 2001 From: yang Date: Mon, 16 Oct 2023 16:49:13 +0900 Subject: [PATCH 20/80] =?UTF-8?q?FindAndRemoveDuplicate=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=EA=B0=92=20=EC=82=AD=EC=A0=9C=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/Problem2/FindAndRemoveDuplicate.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/Problem2/FindAndRemoveDuplicate.java b/src/main/java/Problem2/FindAndRemoveDuplicate.java index b20b73ae29..cb62f64ca0 100644 --- a/src/main/java/Problem2/FindAndRemoveDuplicate.java +++ b/src/main/java/Problem2/FindAndRemoveDuplicate.java @@ -1,9 +1,20 @@ package Problem2; +import java.util.ArrayList; +import java.util.Arrays; public class FindAndRemoveDuplicate { public String FindAndRemve (String cryptogram) { - - return ""; + String[] cryptogramArray = cryptogram.split(""); + ArrayList cryptogramList = new ArrayList(Arrays.asList(cryptogramArray)); + for (int i = 0; i Date: Mon, 16 Oct 2023 16:50:55 +0900 Subject: [PATCH 21/80] =?UTF-8?q?=EC=BD=94=EB=93=9C=EB=A6=AC=EB=B7=B0=202j?= =?UTF-8?q?un0's=20=EC=A4=91=EB=B3=B5=EA=B0=92=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Problem2/eJun0SSockSSock.java | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main/java/Problem2/eJun0SSockSSock.java diff --git a/src/main/java/Problem2/eJun0SSockSSock.java b/src/main/java/Problem2/eJun0SSockSSock.java new file mode 100644 index 0000000000..97c1041580 --- /dev/null +++ b/src/main/java/Problem2/eJun0SSockSSock.java @@ -0,0 +1,35 @@ +package Problem2; + +import java.util.Stack; + +public class eJun0SSockSSock { + // 2jun0's Code + // 1. Stack 생성 + // 2. for문 순회 + // 3. push || pop + + public String ConvertStackToString(Stack stack) { + StringBuilder sb = new StringBuilder(); + // 후입선출 고려 0번째 index에 add가 아닌 insert 해줌. + while (!stack.isEmpty()) { //모두 pop() 되면 종료 + // pop()은 제거하면서 sb에 insert도 가능한가봄 + sb.insert(0,stack.pop()); + } + return sb.toString(); + } + public String RemoveDuplicate(String cryptogram) { + Stack stack = new Stack(); + + for (char c: cryptogram.toCharArray()) { + // 나는 문자열 비교시 equals ( 참조형 비교 위해) 썼는데 char은 기본형이라 == 시용 가능 + if (stack.size() > 0 && stack.peek().equals(c)) { + stack.pop(); + } else { + stack.push(c); + } + } + return ConvertStackToString(stack); + } + + +} From 2c3465ec4a04220bf967bc1ab90a0837f746f387 Mon Sep 17 00:00:00 2001 From: yang Date: Mon, 16 Oct 2023 16:51:20 +0900 Subject: [PATCH 22/80] =?UTF-8?q?Test=20code=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 89 ++++++++++--------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 0e8a82599f..976c44b560 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -8,58 +8,65 @@ import static org.assertj.core.api.Assertions.assertThat; class ApplicationTest { +// @Nested +// class Problem1Test { +// @Test +// void case1() { +// List pobi = List.of(97, 98); +// List crong = List.of(197, 198); +// int result = 0; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// List pobi = List.of(131, 132); +// List crong = List.of(211, 212); +// int result = 1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// +// @Test +// void case3() { +// List pobi = List.of(99, 102); +// List crong = List.of(211, 212); +// int result = -1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// +// @Test +// void case4() { +// List pobi = List.of(1,2); +// List crong = List.of(399,400); +// int result = -1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// } + @Nested - class Problem1Test { + class Problem2Test { @Test void case1() { - List pobi = List.of(97, 98); - List crong = List.of(197, 198); - int result = 0; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + String cryptogram = "browoanoommnaon"; + String result = "brown"; + assertThat(Problem2.solution(cryptogram)).isEqualTo(result); } @Test void case2() { - List pobi = List.of(131, 132); - List crong = List.of(211, 212); - int result = 1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + String cryptogram = "zyelleyz"; + String result = ""; + assertThat(Problem2.solution(cryptogram)).isEqualTo(result); } @Test void case3() { - List pobi = List.of(99, 102); - List crong = List.of(211, 212); - int result = -1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - - @Test - void case4() { - List pobi = List.of(1,2); - List crong = List.of(399,400); - int result = -1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + String cryptogram = ""; + String result = ""; + assertThat(Problem2.solution(cryptogram)).isEqualTo(result); } } -// @Nested -// class Problem2Test { -// @Test -// void case1() { -// String cryptogram = "browoanoommnaon"; -// String result = "brown"; -// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); -// } -// -// @Test -// void case2() { -// String cryptogram = "zyelleyz"; -// String result = ""; -// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); -// } -// } -// // @Nested // class Problem3Test { // @Test @@ -86,7 +93,7 @@ void case4() { // assertThat(Problem4.solution(word)).isEqualTo(result); // } // } -// + // @Nested // class Problem5Test { // @Test @@ -103,7 +110,7 @@ void case4() { // assertThat(Problem5.solution(money)).isEqualTo(result); // } // } -// + // @Nested // class Problem6Test { // @Test @@ -119,7 +126,7 @@ void case4() { // assertThat(Problem6.solution(forms)).isEqualTo(result); // } // } -// + // @Nested // class Problem7Test { // @Test From eb39b73ab1280851e27895a07ff0ba360d63e23b Mon Sep 17 00:00:00 2001 From: yang Date: Mon, 16 Oct 2023 16:51:49 +0900 Subject: [PATCH 23/80] =?UTF-8?q?Problem2=20Main=ED=95=A8=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem2.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/onboarding/Problem2.java b/src/main/java/onboarding/Problem2.java index ee836e9cac..6f3c5c18e1 100644 --- a/src/main/java/onboarding/Problem2.java +++ b/src/main/java/onboarding/Problem2.java @@ -1,8 +1,21 @@ package onboarding; +import Problem2.StringValidation; +import Problem2.FindAndRemoveDuplicate; +import Problem2.eJun0SSockSSock; public class Problem2 { public static String solution(String cryptogram) { - String answer = "answer"; - return answer; + // 문자열 validation check return boolean + StringValidation stringValidation = new StringValidation(); + if (!stringValidation.Validate(cryptogram)) { + return ""; + } + // validation check 값이 true면 중복 삭제 +// FindAndRemoveDuplicate FRD = new FindAndRemoveDuplicate(); +// String result = FRD.FindAndRemve(cryptogram); + //2jun0's + eJun0SSockSSock ejun0 = new eJun0SSockSSock(); + String result = ejun0.RemoveDuplicate(cryptogram); + return result; } } From 7e17955a2d3fc080190a5939a5a140eb84a8e873 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 08:43:39 +0900 Subject: [PATCH 24/80] =?UTF-8?q?=EC=B6=A9=EB=8F=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 225 +++++++++--------- 1 file changed, 109 insertions(+), 116 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 976c44b560..a871e58a95 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -8,40 +8,40 @@ import static org.assertj.core.api.Assertions.assertThat; class ApplicationTest { -// @Nested -// class Problem1Test { -// @Test -// void case1() { -// List pobi = List.of(97, 98); -// List crong = List.of(197, 198); -// int result = 0; -// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); -// } -// -// @Test -// void case2() { -// List pobi = List.of(131, 132); -// List crong = List.of(211, 212); -// int result = 1; -// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); -// } -// -// @Test -// void case3() { -// List pobi = List.of(99, 102); -// List crong = List.of(211, 212); -// int result = -1; -// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); -// } -// -// @Test -// void case4() { -// List pobi = List.of(1,2); -// List crong = List.of(399,400); -// int result = -1; -// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); -// } -// } + @Nested + class Problem1Test { + @Test + void case1() { + List pobi = List.of(97, 98); + List crong = List.of(197, 198); + int result = 0; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + } + + @Test + void case2() { + List pobi = List.of(131, 132); + List crong = List.of(211, 212); + int result = 1; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + } + + @Test + void case3() { + List pobi = List.of(99, 102); + List crong = List.of(211, 212); + int result = -1; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + } + + @Test + void case4() { + List pobi = List.of(1,2); + List crong = List.of(399,400); + int result = -1; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + } + } @Nested class Problem2Test { @@ -58,91 +58,84 @@ void case2() { String result = ""; assertThat(Problem2.solution(cryptogram)).isEqualTo(result); } + } + @Nested + class Problem3Test { @Test - void case3() { - String cryptogram = ""; - String result = ""; - assertThat(Problem2.solution(cryptogram)).isEqualTo(result); + void case1() { + int number = 13; + int result = 4; + assertThat(Problem3.solution(number)).isEqualTo(result); + } + + @Test + void case2() { + int number = 33; + int result = 14; + assertThat(Problem3.solution(number)).isEqualTo(result); } } -// @Nested -// class Problem3Test { -// @Test -// void case1() { -// int number = 13; -// int result = 4; -// assertThat(Problem3.solution(number)).isEqualTo(result); -// } -// -// @Test -// void case2() { -// int number = 33; -// int result = 14; -// assertThat(Problem3.solution(number)).isEqualTo(result); -// } -// } -// -// @Nested -// class Problem4Test { -// @Test -// void case1() { -// String word = "I love you"; -// String result = "R olev blf"; -// assertThat(Problem4.solution(word)).isEqualTo(result); -// } -// } - -// @Nested -// class Problem5Test { -// @Test -// void case1() { -// int money = 50_237; -// List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); -// assertThat(Problem5.solution(money)).isEqualTo(result); -// } -// -// @Test -// void case2() { -// int money = 15_000; -// List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); -// assertThat(Problem5.solution(money)).isEqualTo(result); -// } -// } - -// @Nested -// class Problem6Test { -// @Test -// void case1() { -// List> forms = List.of( -// List.of("jm@email.com", "제이엠"), -// List.of("jason@email.com", "제이슨"), -// List.of("woniee@email.com", "워니"), -// List.of("mj@email.com", "엠제이"), -// List.of("nowm@email.com", "이제엠") -// ); -// List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); -// assertThat(Problem6.solution(forms)).isEqualTo(result); -// } -// } - -// @Nested -// class Problem7Test { -// @Test -// void case1() { -// String user = "mrko"; -// List> friends = List.of( -// List.of("donut", "andole"), -// List.of("donut", "jun"), -// List.of("donut", "mrko"), -// List.of("shakevan", "andole"), -// List.of("shakevan", "jun"), -// List.of("shakevan", "mrko") -// ); -// List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); -// List result = List.of("andole", "jun", "bedi"); -// assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); -// } -// } + @Nested + class Problem4Test { + @Test + void case1() { + String word = "I love you"; + String result = "R olev blf"; + assertThat(Problem4.solution(word)).isEqualTo(result); + } + } + + @Nested + class Problem5Test { + @Test + void case1() { + int money = 50_237; + List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); + assertThat(Problem5.solution(money)).isEqualTo(result); + } + + @Test + void case2() { + int money = 15_000; + List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); + assertThat(Problem5.solution(money)).isEqualTo(result); + } + } + + @Nested + class Problem6Test { + @Test + void case1() { + List> forms = List.of( + List.of("jm@email.com", "제이엠"), + List.of("jason@email.com", "제이슨"), + List.of("woniee@email.com", "워니"), + List.of("mj@email.com", "엠제이"), + List.of("nowm@email.com", "이제엠") + ); + List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); + assertThat(Problem6.solution(forms)).isEqualTo(result); + } + } + + @Nested + class Problem7Test { + @Test + void case1() { + String user = "mrko"; + List> friends = List.of( + List.of("donut", "andole"), + List.of("donut", "jun"), + List.of("donut", "mrko"), + List.of("shakevan", "andole"), + List.of("shakevan", "jun"), + List.of("shakevan", "mrko") + ); + List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); + List result = List.of("andole", "jun", "bedi"); + assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); + } + } } From 4e2a94284d63ca12c77b1e4bab2b670c8c5b1e21 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 08:54:01 +0900 Subject: [PATCH 25/80] =?UTF-8?q?FindAndRemoveDuplicate=20=EC=B6=A9?= =?UTF-8?q?=EB=8F=8C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Problem2/FindAndRemoveDuplicate.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/Problem2/FindAndRemoveDuplicate.java b/src/main/java/Problem2/FindAndRemoveDuplicate.java index cb62f64ca0..8bd259b4d9 100644 --- a/src/main/java/Problem2/FindAndRemoveDuplicate.java +++ b/src/main/java/Problem2/FindAndRemoveDuplicate.java @@ -1,12 +1,11 @@ package Problem2; import java.util.ArrayList; import java.util.Arrays; - public class FindAndRemoveDuplicate { public String FindAndRemve (String cryptogram) { String[] cryptogramArray = cryptogram.split(""); - ArrayList cryptogramList = new ArrayList(Arrays.asList(cryptogramArray)); + ArrayList cryptogramList = new ArrayList<>(Arrays.asList(cryptogramArray)); for (int i = 0; i Date: Tue, 17 Oct 2023 08:57:24 +0900 Subject: [PATCH 26/80] =?UTF-8?q?FindAndRemoveDuplicate=20=EC=B6=A9?= =?UTF-8?q?=EB=8F=8C=20=ED=95=B4=EA=B2=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Problem2/FindAndRemoveDuplicate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/Problem2/FindAndRemoveDuplicate.java b/src/main/java/Problem2/FindAndRemoveDuplicate.java index 8bd259b4d9..cb62f64ca0 100644 --- a/src/main/java/Problem2/FindAndRemoveDuplicate.java +++ b/src/main/java/Problem2/FindAndRemoveDuplicate.java @@ -1,11 +1,12 @@ package Problem2; import java.util.ArrayList; import java.util.Arrays; + public class FindAndRemoveDuplicate { public String FindAndRemve (String cryptogram) { String[] cryptogramArray = cryptogram.split(""); - ArrayList cryptogramList = new ArrayList<>(Arrays.asList(cryptogramArray)); + ArrayList cryptogramList = new ArrayList(Arrays.asList(cryptogramArray)); for (int i = 0; i Date: Tue, 17 Oct 2023 08:59:59 +0900 Subject: [PATCH 27/80] =?UTF-8?q?Test=EC=BD=94=EB=93=9C=20=EC=B6=A9?= =?UTF-8?q?=EB=8F=8C=20=ED=95=B4=EA=B2=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 190 +++++++++--------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index a871e58a95..0e8a82599f 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -43,99 +43,99 @@ void case4() { } } - @Nested - class Problem2Test { - @Test - void case1() { - String cryptogram = "browoanoommnaon"; - String result = "brown"; - assertThat(Problem2.solution(cryptogram)).isEqualTo(result); - } - - @Test - void case2() { - String cryptogram = "zyelleyz"; - String result = ""; - assertThat(Problem2.solution(cryptogram)).isEqualTo(result); - } - } - - @Nested - class Problem3Test { - @Test - void case1() { - int number = 13; - int result = 4; - assertThat(Problem3.solution(number)).isEqualTo(result); - } - - @Test - void case2() { - int number = 33; - int result = 14; - assertThat(Problem3.solution(number)).isEqualTo(result); - } - } - - @Nested - class Problem4Test { - @Test - void case1() { - String word = "I love you"; - String result = "R olev blf"; - assertThat(Problem4.solution(word)).isEqualTo(result); - } - } - - @Nested - class Problem5Test { - @Test - void case1() { - int money = 50_237; - List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); - assertThat(Problem5.solution(money)).isEqualTo(result); - } - - @Test - void case2() { - int money = 15_000; - List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); - assertThat(Problem5.solution(money)).isEqualTo(result); - } - } - - @Nested - class Problem6Test { - @Test - void case1() { - List> forms = List.of( - List.of("jm@email.com", "제이엠"), - List.of("jason@email.com", "제이슨"), - List.of("woniee@email.com", "워니"), - List.of("mj@email.com", "엠제이"), - List.of("nowm@email.com", "이제엠") - ); - List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); - assertThat(Problem6.solution(forms)).isEqualTo(result); - } - } - - @Nested - class Problem7Test { - @Test - void case1() { - String user = "mrko"; - List> friends = List.of( - List.of("donut", "andole"), - List.of("donut", "jun"), - List.of("donut", "mrko"), - List.of("shakevan", "andole"), - List.of("shakevan", "jun"), - List.of("shakevan", "mrko") - ); - List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); - List result = List.of("andole", "jun", "bedi"); - assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); - } - } +// @Nested +// class Problem2Test { +// @Test +// void case1() { +// String cryptogram = "browoanoommnaon"; +// String result = "brown"; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// String cryptogram = "zyelleyz"; +// String result = ""; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem3Test { +// @Test +// void case1() { +// int number = 13; +// int result = 4; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// int number = 33; +// int result = 14; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem4Test { +// @Test +// void case1() { +// String word = "I love you"; +// String result = "R olev blf"; +// assertThat(Problem4.solution(word)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem5Test { +// @Test +// void case1() { +// int money = 50_237; +// List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); +// assertThat(Problem5.solution(money)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// int money = 15_000; +// List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); +// assertThat(Problem5.solution(money)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem6Test { +// @Test +// void case1() { +// List> forms = List.of( +// List.of("jm@email.com", "제이엠"), +// List.of("jason@email.com", "제이슨"), +// List.of("woniee@email.com", "워니"), +// List.of("mj@email.com", "엠제이"), +// List.of("nowm@email.com", "이제엠") +// ); +// List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); +// assertThat(Problem6.solution(forms)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem7Test { +// @Test +// void case1() { +// String user = "mrko"; +// List> friends = List.of( +// List.of("donut", "andole"), +// List.of("donut", "jun"), +// List.of("donut", "mrko"), +// List.of("shakevan", "andole"), +// List.of("shakevan", "jun"), +// List.of("shakevan", "mrko") +// ); +// List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); +// List result = List.of("andole", "jun", "bedi"); +// assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); +// } +// } } From fb6032385e379d0e0ae49954a8670439c5dd0cac Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:43:22 +0900 Subject: [PATCH 28/80] =?UTF-8?q?=EC=BB=A4=EB=B0=8B=EC=BB=A4=EB=B0=8B;;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Test/README.md b/Test/README.md index 2c361a35fd..a555ac76b8 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,4 +1,4 @@ -# Git 연결 확인 test ---- -:raised_hand: -- 안녕 \ No newline at end of file +# Git 연결 확인 test2 +- - - +- hellogut +- hi \ No newline at end of file From 28eade55a1aae5ecaf13285ad1b585adb061d4ff Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:54:12 +0900 Subject: [PATCH 29/80] =?UTF-8?q?Revert=20"=EC=BB=A4=EB=B0=8B=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit afdb9b7f1deb9594739d3e8d9a547140a502f708. --- Test/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Test/README.md b/Test/README.md index a555ac76b8..7d5a96a066 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,4 +1,3 @@ -# Git 연결 확인 test2 -- - - -- hellogut -- hi \ No newline at end of file +# Git 연결 확인 test +--- +:raised_hand: \ No newline at end of file From f89636911af3c52c9b02c3753645869c4672e8b2 Mon Sep 17 00:00:00 2001 From: yang Date: Fri, 13 Oct 2023 09:55:21 +0900 Subject: [PATCH 30/80] =?UTF-8?q?com=20=EC=BB=A4=EB=B0=8B=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Test/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Test/README.md b/Test/README.md index 7d5a96a066..2c361a35fd 100644 --- a/Test/README.md +++ b/Test/README.md @@ -1,3 +1,4 @@ # Git 연결 확인 test --- -:raised_hand: \ No newline at end of file +:raised_hand: +- 안녕 \ No newline at end of file From 0fd7ded312c79bcba923053c4b7932263362de10 Mon Sep 17 00:00:00 2001 From: yang Date: Mon, 16 Oct 2023 16:51:20 +0900 Subject: [PATCH 31/80] =?UTF-8?q?Test=20code=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 89 ++++++++++--------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 0e8a82599f..976c44b560 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -8,58 +8,65 @@ import static org.assertj.core.api.Assertions.assertThat; class ApplicationTest { +// @Nested +// class Problem1Test { +// @Test +// void case1() { +// List pobi = List.of(97, 98); +// List crong = List.of(197, 198); +// int result = 0; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// List pobi = List.of(131, 132); +// List crong = List.of(211, 212); +// int result = 1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// +// @Test +// void case3() { +// List pobi = List.of(99, 102); +// List crong = List.of(211, 212); +// int result = -1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// +// @Test +// void case4() { +// List pobi = List.of(1,2); +// List crong = List.of(399,400); +// int result = -1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// } + @Nested - class Problem1Test { + class Problem2Test { @Test void case1() { - List pobi = List.of(97, 98); - List crong = List.of(197, 198); - int result = 0; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + String cryptogram = "browoanoommnaon"; + String result = "brown"; + assertThat(Problem2.solution(cryptogram)).isEqualTo(result); } @Test void case2() { - List pobi = List.of(131, 132); - List crong = List.of(211, 212); - int result = 1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + String cryptogram = "zyelleyz"; + String result = ""; + assertThat(Problem2.solution(cryptogram)).isEqualTo(result); } @Test void case3() { - List pobi = List.of(99, 102); - List crong = List.of(211, 212); - int result = -1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - - @Test - void case4() { - List pobi = List.of(1,2); - List crong = List.of(399,400); - int result = -1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + String cryptogram = ""; + String result = ""; + assertThat(Problem2.solution(cryptogram)).isEqualTo(result); } } -// @Nested -// class Problem2Test { -// @Test -// void case1() { -// String cryptogram = "browoanoommnaon"; -// String result = "brown"; -// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); -// } -// -// @Test -// void case2() { -// String cryptogram = "zyelleyz"; -// String result = ""; -// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); -// } -// } -// // @Nested // class Problem3Test { // @Test @@ -86,7 +93,7 @@ void case4() { // assertThat(Problem4.solution(word)).isEqualTo(result); // } // } -// + // @Nested // class Problem5Test { // @Test @@ -103,7 +110,7 @@ void case4() { // assertThat(Problem5.solution(money)).isEqualTo(result); // } // } -// + // @Nested // class Problem6Test { // @Test @@ -119,7 +126,7 @@ void case4() { // assertThat(Problem6.solution(forms)).isEqualTo(result); // } // } -// + // @Nested // class Problem7Test { // @Test From 2bb13a8660a27178016479d1d89979e8ba5f3bfd Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 08:43:39 +0900 Subject: [PATCH 32/80] =?UTF-8?q?=EC=B6=A9=EB=8F=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 225 +++++++++--------- 1 file changed, 109 insertions(+), 116 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 976c44b560..a871e58a95 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -8,40 +8,40 @@ import static org.assertj.core.api.Assertions.assertThat; class ApplicationTest { -// @Nested -// class Problem1Test { -// @Test -// void case1() { -// List pobi = List.of(97, 98); -// List crong = List.of(197, 198); -// int result = 0; -// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); -// } -// -// @Test -// void case2() { -// List pobi = List.of(131, 132); -// List crong = List.of(211, 212); -// int result = 1; -// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); -// } -// -// @Test -// void case3() { -// List pobi = List.of(99, 102); -// List crong = List.of(211, 212); -// int result = -1; -// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); -// } -// -// @Test -// void case4() { -// List pobi = List.of(1,2); -// List crong = List.of(399,400); -// int result = -1; -// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); -// } -// } + @Nested + class Problem1Test { + @Test + void case1() { + List pobi = List.of(97, 98); + List crong = List.of(197, 198); + int result = 0; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + } + + @Test + void case2() { + List pobi = List.of(131, 132); + List crong = List.of(211, 212); + int result = 1; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + } + + @Test + void case3() { + List pobi = List.of(99, 102); + List crong = List.of(211, 212); + int result = -1; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + } + + @Test + void case4() { + List pobi = List.of(1,2); + List crong = List.of(399,400); + int result = -1; + assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); + } + } @Nested class Problem2Test { @@ -58,91 +58,84 @@ void case2() { String result = ""; assertThat(Problem2.solution(cryptogram)).isEqualTo(result); } + } + @Nested + class Problem3Test { @Test - void case3() { - String cryptogram = ""; - String result = ""; - assertThat(Problem2.solution(cryptogram)).isEqualTo(result); + void case1() { + int number = 13; + int result = 4; + assertThat(Problem3.solution(number)).isEqualTo(result); + } + + @Test + void case2() { + int number = 33; + int result = 14; + assertThat(Problem3.solution(number)).isEqualTo(result); } } -// @Nested -// class Problem3Test { -// @Test -// void case1() { -// int number = 13; -// int result = 4; -// assertThat(Problem3.solution(number)).isEqualTo(result); -// } -// -// @Test -// void case2() { -// int number = 33; -// int result = 14; -// assertThat(Problem3.solution(number)).isEqualTo(result); -// } -// } -// -// @Nested -// class Problem4Test { -// @Test -// void case1() { -// String word = "I love you"; -// String result = "R olev blf"; -// assertThat(Problem4.solution(word)).isEqualTo(result); -// } -// } - -// @Nested -// class Problem5Test { -// @Test -// void case1() { -// int money = 50_237; -// List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); -// assertThat(Problem5.solution(money)).isEqualTo(result); -// } -// -// @Test -// void case2() { -// int money = 15_000; -// List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); -// assertThat(Problem5.solution(money)).isEqualTo(result); -// } -// } - -// @Nested -// class Problem6Test { -// @Test -// void case1() { -// List> forms = List.of( -// List.of("jm@email.com", "제이엠"), -// List.of("jason@email.com", "제이슨"), -// List.of("woniee@email.com", "워니"), -// List.of("mj@email.com", "엠제이"), -// List.of("nowm@email.com", "이제엠") -// ); -// List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); -// assertThat(Problem6.solution(forms)).isEqualTo(result); -// } -// } - -// @Nested -// class Problem7Test { -// @Test -// void case1() { -// String user = "mrko"; -// List> friends = List.of( -// List.of("donut", "andole"), -// List.of("donut", "jun"), -// List.of("donut", "mrko"), -// List.of("shakevan", "andole"), -// List.of("shakevan", "jun"), -// List.of("shakevan", "mrko") -// ); -// List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); -// List result = List.of("andole", "jun", "bedi"); -// assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); -// } -// } + @Nested + class Problem4Test { + @Test + void case1() { + String word = "I love you"; + String result = "R olev blf"; + assertThat(Problem4.solution(word)).isEqualTo(result); + } + } + + @Nested + class Problem5Test { + @Test + void case1() { + int money = 50_237; + List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); + assertThat(Problem5.solution(money)).isEqualTo(result); + } + + @Test + void case2() { + int money = 15_000; + List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); + assertThat(Problem5.solution(money)).isEqualTo(result); + } + } + + @Nested + class Problem6Test { + @Test + void case1() { + List> forms = List.of( + List.of("jm@email.com", "제이엠"), + List.of("jason@email.com", "제이슨"), + List.of("woniee@email.com", "워니"), + List.of("mj@email.com", "엠제이"), + List.of("nowm@email.com", "이제엠") + ); + List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); + assertThat(Problem6.solution(forms)).isEqualTo(result); + } + } + + @Nested + class Problem7Test { + @Test + void case1() { + String user = "mrko"; + List> friends = List.of( + List.of("donut", "andole"), + List.of("donut", "jun"), + List.of("donut", "mrko"), + List.of("shakevan", "andole"), + List.of("shakevan", "jun"), + List.of("shakevan", "mrko") + ); + List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); + List result = List.of("andole", "jun", "bedi"); + assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); + } + } } From 6afafa411403bf4a7e3fc81f12aacaa1d0bb4e91 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 08:54:01 +0900 Subject: [PATCH 33/80] =?UTF-8?q?FindAndRemoveDuplicate=20=EC=B6=A9?= =?UTF-8?q?=EB=8F=8C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Problem2/FindAndRemoveDuplicate.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/Problem2/FindAndRemoveDuplicate.java b/src/main/java/Problem2/FindAndRemoveDuplicate.java index cb62f64ca0..8bd259b4d9 100644 --- a/src/main/java/Problem2/FindAndRemoveDuplicate.java +++ b/src/main/java/Problem2/FindAndRemoveDuplicate.java @@ -1,12 +1,11 @@ package Problem2; import java.util.ArrayList; import java.util.Arrays; - public class FindAndRemoveDuplicate { public String FindAndRemve (String cryptogram) { String[] cryptogramArray = cryptogram.split(""); - ArrayList cryptogramList = new ArrayList(Arrays.asList(cryptogramArray)); + ArrayList cryptogramList = new ArrayList<>(Arrays.asList(cryptogramArray)); for (int i = 0; i Date: Tue, 17 Oct 2023 08:57:24 +0900 Subject: [PATCH 34/80] =?UTF-8?q?FindAndRemoveDuplicate=20=EC=B6=A9?= =?UTF-8?q?=EB=8F=8C=20=ED=95=B4=EA=B2=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/Problem2/FindAndRemoveDuplicate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/Problem2/FindAndRemoveDuplicate.java b/src/main/java/Problem2/FindAndRemoveDuplicate.java index 8bd259b4d9..cb62f64ca0 100644 --- a/src/main/java/Problem2/FindAndRemoveDuplicate.java +++ b/src/main/java/Problem2/FindAndRemoveDuplicate.java @@ -1,11 +1,12 @@ package Problem2; import java.util.ArrayList; import java.util.Arrays; + public class FindAndRemoveDuplicate { public String FindAndRemve (String cryptogram) { String[] cryptogramArray = cryptogram.split(""); - ArrayList cryptogramList = new ArrayList<>(Arrays.asList(cryptogramArray)); + ArrayList cryptogramList = new ArrayList(Arrays.asList(cryptogramArray)); for (int i = 0; i Date: Tue, 17 Oct 2023 08:59:59 +0900 Subject: [PATCH 35/80] =?UTF-8?q?Test=EC=BD=94=EB=93=9C=20=EC=B6=A9?= =?UTF-8?q?=EB=8F=8C=20=ED=95=B4=EA=B2=B02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 190 +++++++++--------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index a871e58a95..0e8a82599f 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -43,99 +43,99 @@ void case4() { } } - @Nested - class Problem2Test { - @Test - void case1() { - String cryptogram = "browoanoommnaon"; - String result = "brown"; - assertThat(Problem2.solution(cryptogram)).isEqualTo(result); - } - - @Test - void case2() { - String cryptogram = "zyelleyz"; - String result = ""; - assertThat(Problem2.solution(cryptogram)).isEqualTo(result); - } - } - - @Nested - class Problem3Test { - @Test - void case1() { - int number = 13; - int result = 4; - assertThat(Problem3.solution(number)).isEqualTo(result); - } - - @Test - void case2() { - int number = 33; - int result = 14; - assertThat(Problem3.solution(number)).isEqualTo(result); - } - } - - @Nested - class Problem4Test { - @Test - void case1() { - String word = "I love you"; - String result = "R olev blf"; - assertThat(Problem4.solution(word)).isEqualTo(result); - } - } - - @Nested - class Problem5Test { - @Test - void case1() { - int money = 50_237; - List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); - assertThat(Problem5.solution(money)).isEqualTo(result); - } - - @Test - void case2() { - int money = 15_000; - List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); - assertThat(Problem5.solution(money)).isEqualTo(result); - } - } - - @Nested - class Problem6Test { - @Test - void case1() { - List> forms = List.of( - List.of("jm@email.com", "제이엠"), - List.of("jason@email.com", "제이슨"), - List.of("woniee@email.com", "워니"), - List.of("mj@email.com", "엠제이"), - List.of("nowm@email.com", "이제엠") - ); - List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); - assertThat(Problem6.solution(forms)).isEqualTo(result); - } - } - - @Nested - class Problem7Test { - @Test - void case1() { - String user = "mrko"; - List> friends = List.of( - List.of("donut", "andole"), - List.of("donut", "jun"), - List.of("donut", "mrko"), - List.of("shakevan", "andole"), - List.of("shakevan", "jun"), - List.of("shakevan", "mrko") - ); - List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); - List result = List.of("andole", "jun", "bedi"); - assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); - } - } +// @Nested +// class Problem2Test { +// @Test +// void case1() { +// String cryptogram = "browoanoommnaon"; +// String result = "brown"; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// String cryptogram = "zyelleyz"; +// String result = ""; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem3Test { +// @Test +// void case1() { +// int number = 13; +// int result = 4; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// int number = 33; +// int result = 14; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem4Test { +// @Test +// void case1() { +// String word = "I love you"; +// String result = "R olev blf"; +// assertThat(Problem4.solution(word)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem5Test { +// @Test +// void case1() { +// int money = 50_237; +// List result = List.of(1, 0, 0, 0, 0, 2, 0, 3, 7); +// assertThat(Problem5.solution(money)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// int money = 15_000; +// List result = List.of(0, 1, 1, 0, 0, 0, 0, 0, 0); +// assertThat(Problem5.solution(money)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem6Test { +// @Test +// void case1() { +// List> forms = List.of( +// List.of("jm@email.com", "제이엠"), +// List.of("jason@email.com", "제이슨"), +// List.of("woniee@email.com", "워니"), +// List.of("mj@email.com", "엠제이"), +// List.of("nowm@email.com", "이제엠") +// ); +// List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); +// assertThat(Problem6.solution(forms)).isEqualTo(result); +// } +// } +// +// @Nested +// class Problem7Test { +// @Test +// void case1() { +// String user = "mrko"; +// List> friends = List.of( +// List.of("donut", "andole"), +// List.of("donut", "jun"), +// List.of("donut", "mrko"), +// List.of("shakevan", "andole"), +// List.of("shakevan", "jun"), +// List.of("shakevan", "mrko") +// ); +// List visitors = List.of("bedi", "bedi", "donut", "bedi", "shakevan"); +// List result = List.of("andole", "jun", "bedi"); +// assertThat(Problem7.solution(user, friends, visitors)).isEqualTo(result); +// } +// } } From ff00a710658b7ba987c6ed2942aa75e2a55971a0 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 10:56:44 +0900 Subject: [PATCH 36/80] =?UTF-8?q?yangyanghyunjung=EC=97=90=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A53=20=EB=AA=A9=EB=A1=9D=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/functionList3.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/main/java/problem3/functionList3.md diff --git a/src/main/java/problem3/functionList3.md b/src/main/java/problem3/functionList3.md new file mode 100644 index 0000000000..21dc91fc52 --- /dev/null +++ b/src/main/java/problem3/functionList3.md @@ -0,0 +1 @@ +# 🚀 problem3 기능목록 From 97f76cad2e01b36d73818c2159992a901c627a7e Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 10:58:38 +0900 Subject: [PATCH 37/80] =?UTF-8?q?yangyanghyunjung=EC=97=90=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A53=20=EB=AA=A9=EB=A1=9D=20=EC=BB=A4=EB=B0=8B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/functionList3.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/problem3/functionList3.md b/src/main/java/problem3/functionList3.md index 21dc91fc52..9ce7429d0d 100644 --- a/src/main/java/problem3/functionList3.md +++ b/src/main/java/problem3/functionList3.md @@ -1 +1,2 @@ # 🚀 problem3 기능목록 +[배달이가 좋아하는 369 게임] \ No newline at end of file From 7e7ad31f680661c452120a1f8c4bc602de34f69f Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 11:04:16 +0900 Subject: [PATCH 38/80] =?UTF-8?q?yangyanghyunjung=EC=97=90=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A53=20=EB=AA=A9=EB=A1=9D=20=EC=BB=A4=EB=B0=8B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/functionList3.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/problem3/functionList3.md b/src/main/java/problem3/functionList3.md index 9ce7429d0d..21dc91fc52 100644 --- a/src/main/java/problem3/functionList3.md +++ b/src/main/java/problem3/functionList3.md @@ -1,2 +1 @@ # 🚀 problem3 기능목록 -[배달이가 좋아하는 369 게임] \ No newline at end of file From 323327a1ae1b205841a91196eac3b99064ec752a Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:04:46 +0900 Subject: [PATCH 39/80] =?UTF-8?q?problem3=20=EA=B8=B0=EB=8A=A5=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/functionList3.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/problem3/functionList3.md b/src/main/java/problem3/functionList3.md index 21dc91fc52..737d5fc9dd 100644 --- a/src/main/java/problem3/functionList3.md +++ b/src/main/java/problem3/functionList3.md @@ -1 +1,9 @@ # 🚀 problem3 기능목록 +- - - +**1. NumberValidation** +> - number이 1 이하 1000 이상일 경우 exception + +**2. ClapCount** +> - number에 3, 6, 9 가 포함 되면 : count++; +> - return count; +> - 3,6,9 가 n 번 포함 되어 있을 경우는 n번 counting \ No newline at end of file From 9e941153b8ef38c7ad8916c267567d192d47ed61 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:05:19 +0900 Subject: [PATCH 40/80] =?UTF-8?q?problem3=5F=20NumberValidation=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/NumberValidation.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/problem3/NumberValidation.java diff --git a/src/main/java/problem3/NumberValidation.java b/src/main/java/problem3/NumberValidation.java new file mode 100644 index 0000000000..41edcd99f9 --- /dev/null +++ b/src/main/java/problem3/NumberValidation.java @@ -0,0 +1,12 @@ +package problem3; + +public class NumberValidation { + public int validateNumber (int number) { + if (number < 1 || number > 1000) { + System.out.println("1 이상 1000 이하의 숫자만 가능합니다."); + return -1; + } + ClapCount clapCount = new ClapCount(); + return clapCount.CountCalp(number); + } +} From 4a925c5811992fddb88ae6bf269e921c1b8536a7 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:05:43 +0900 Subject: [PATCH 41/80] =?UTF-8?q?problem3=5F=20ClapCount=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/ClapCount.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/main/java/problem3/ClapCount.java diff --git a/src/main/java/problem3/ClapCount.java b/src/main/java/problem3/ClapCount.java new file mode 100644 index 0000000000..d3c8edd95a --- /dev/null +++ b/src/main/java/problem3/ClapCount.java @@ -0,0 +1,17 @@ +package problem3; + +public class ClapCount { + public int CountCalp(int number) { + int count = 0; + for (int i = 1; i <= number; ++i) { + String stringNumber = Integer.toString(i); + // 2번 이상일 경우 + for (int j = 0; j < stringNumber.length(); ++j){ + if (stringNumber.charAt(j) == '3' || stringNumber.charAt(j) == '6' || stringNumber.charAt(j) == '9') { + count++; + } + } + } + return count; + } +} From 9e332cdc3fcde5d5cae8c7190f55446cad4ab9ae Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:06:31 +0900 Subject: [PATCH 42/80] =?UTF-8?q?problem3=5F=20Main=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem3.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/onboarding/Problem3.java b/src/main/java/onboarding/Problem3.java index 12e095d6e3..bb48bf82c1 100644 --- a/src/main/java/onboarding/Problem3.java +++ b/src/main/java/onboarding/Problem3.java @@ -1,8 +1,9 @@ package onboarding; +import problem3.NumberValidation; public class Problem3 { public static int solution(int number) { - int answer = 0; - return answer; + NumberValidation numberValidation = new NumberValidation(); + return numberValidation.validateNumber(number); } } From e0508aa2a201c218e88c28fb5641fd20938555dd Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:07:20 +0900 Subject: [PATCH 43/80] =?UTF-8?q?problem3=5F=20TestCode=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 107 ++++++++++-------- 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 0e8a82599f..47cec90ec5 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -8,75 +8,82 @@ import static org.assertj.core.api.Assertions.assertThat; class ApplicationTest { - @Nested - class Problem1Test { - @Test - void case1() { - List pobi = List.of(97, 98); - List crong = List.of(197, 198); - int result = 0; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - - @Test - void case2() { - List pobi = List.of(131, 132); - List crong = List.of(211, 212); - int result = 1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - - @Test - void case3() { - List pobi = List.of(99, 102); - List crong = List.of(211, 212); - int result = -1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - - @Test - void case4() { - List pobi = List.of(1,2); - List crong = List.of(399,400); - int result = -1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - } - // @Nested -// class Problem2Test { +// class Problem1Test { // @Test // void case1() { -// String cryptogram = "browoanoommnaon"; -// String result = "brown"; -// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// List pobi = List.of(97, 98); +// List crong = List.of(197, 198); +// int result = 0; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); // } // // @Test // void case2() { -// String cryptogram = "zyelleyz"; -// String result = ""; -// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// List pobi = List.of(131, 132); +// List crong = List.of(211, 212); +// int result = 1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// +// @Test +// void case3() { +// List pobi = List.of(99, 102); +// List crong = List.of(211, 212); +// int result = -1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); // } -// } // +// @Test +// void case4() { +// List pobi = List.of(1,2); +// List crong = List.of(399,400); +// int result = -1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// } + // @Nested -// class Problem3Test { +// class Problem2Test { // @Test // void case1() { -// int number = 13; -// int result = 4; -// assertThat(Problem3.solution(number)).isEqualTo(result); +// String cryptogram = "browoanoommnaon"; +// String result = "brown"; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); // } // // @Test // void case2() { -// int number = 33; -// int result = 14; -// assertThat(Problem3.solution(number)).isEqualTo(result); +// String cryptogram = "zyelleyz"; +// String result = ""; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); // } // } // + @Nested + class Problem3Test { + @Test + void case1() { + int number = 13; + int result = 4; + assertThat(Problem3.solution(number)).isEqualTo(result); + } + + @Test + void case2() { + int number = 33; + int result = 14; + assertThat(Problem3.solution(number)).isEqualTo(result); + } + + @Test + void case3() { + int number = -1; + int result = -1; + assertThat(Problem3.solution(number)).isEqualTo(result); + } + } + // @Nested // class Problem4Test { // @Test From a5bc7fedb0cd0c8a1d1af03e997e526c2591078e Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 17:07:05 +0900 Subject: [PATCH 44/80] =?UTF-8?q?problem3=5F=20jiyeong's=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=EB=A6=AC=EB=B7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/ClapCount.java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/problem3/ClapCount.java b/src/main/java/problem3/ClapCount.java index d3c8edd95a..34417f6cb3 100644 --- a/src/main/java/problem3/ClapCount.java +++ b/src/main/java/problem3/ClapCount.java @@ -3,15 +3,26 @@ public class ClapCount { public int CountCalp(int number) { int count = 0; - for (int i = 1; i <= number; ++i) { - String stringNumber = Integer.toString(i); - // 2번 이상일 경우 - for (int j = 0; j < stringNumber.length(); ++j){ - if (stringNumber.charAt(j) == '3' || stringNumber.charAt(j) == '6' || stringNumber.charAt(j) == '9') { +// for (int i = 1; i <= number; ++i) { +// String stringNumber = Integer.toString(i); +// // 2번 이상일 경우 +// for (int j = 0; j < stringNumber.length(); ++j){ +// if (stringNumber.charAt(j) == '3' || stringNumber.charAt(j) == '6' || stringNumber.charAt(j) == '9') { +// count++; +// } +// } +// } + //jiyeong's Code + (-48) + for (int i = 1; i < number + 1; ++i) { + String strNum = Integer.toString(i); + for (int j = 0; j < strNum.length(); ++j) { + int convertIntNum = strNum.charAt(j) - 48; + if (convertIntNum % 3 == 0 && convertIntNum != 0) { count++; } } } + return count; } } From 312ed9e848ff5a67fe6c73833595ad737cb14e3c Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 23:13:01 +0900 Subject: [PATCH 45/80] =?UTF-8?q?problem4=20=EA=B8=B0=EB=8A=A5=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/functionList.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/java/problem4/functionList.md diff --git a/src/main/java/problem4/functionList.md b/src/main/java/problem4/functionList.md new file mode 100644 index 0000000000..6663bac5a2 --- /dev/null +++ b/src/main/java/problem4/functionList.md @@ -0,0 +1,11 @@ +# 🚀 problem4 기능 목록 +- - - +### 1. WordLengthValidation +> - word 길이가 1 이하 1000 이상인 경우 +> - 알파벳 외의 문자가 들어 올 경우 + +### 2. ConvertAlphabet +> - 대문자가 들어 올 경우 +> - 'A' 는 'z' 로 +> - 소문자가 들어 올 경우 +> - 'z' 는 'A' 로 From 3007fd608ad95ff7007ba2ae1f63a2a386ffb691 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:20:39 +0900 Subject: [PATCH 46/80] =?UTF-8?q?problem4=5FWordValidation=20=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/WordValidation.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main/java/problem4/WordValidation.java diff --git a/src/main/java/problem4/WordValidation.java b/src/main/java/problem4/WordValidation.java new file mode 100644 index 0000000000..66df4a5364 --- /dev/null +++ b/src/main/java/problem4/WordValidation.java @@ -0,0 +1,22 @@ +package problem4; + +public class WordValidation { + public boolean ValidateWordLength(String word) { + if (word.length() > 1 && word.length() < 1000) { + return ValidateAlphabet(word); + } + return false; + } + + public boolean ValidateAlphabet(String word) { + char[] wordCharArray = word.toCharArray(); + for (char c: wordCharArray) { + if (c < 56 && c > 123 && c != 32) { + throw new IllegalArgumentException("알파벳이 아닙니다"); + } else if (c > 90 && c < 97) { + throw new IllegalArgumentException("알파벳이 아닙니다"); + } + } + return true; + } +} From feabc5ff73e232941bd0d301c9c80d4680c9c4ed Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:21:09 +0900 Subject: [PATCH 47/80] =?UTF-8?q?problem4=5FConvertWord=20=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/ConvertWord.java | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/problem4/ConvertWord.java diff --git a/src/main/java/problem4/ConvertWord.java b/src/main/java/problem4/ConvertWord.java new file mode 100644 index 0000000000..813d0f71ed --- /dev/null +++ b/src/main/java/problem4/ConvertWord.java @@ -0,0 +1,30 @@ +package problem4; + +public class ConvertWord { + public String ConvertWord(String word) { + char[] wordCharArray = word.toCharArray(); + StringBuilder builder = new StringBuilder(1024); + // 기준점 +// int A = 65; +// int Z = 90; +// int a = 97; +// int z = 123; + + // 이 부분 리팩토링 필요 !! 23/10/18 + for (char c: wordCharArray) { + if (c > 64 && c < 91) { + // 대문자 > 대문자 + int T = 90 - (c - 65); + builder.append((char)T); + } else if (c > 96 && c < 123) { + // 소문자 > 소문자 + int t = 122 - (c - 97); + builder.append((char)t); + } else if (c == 32) { + // 스페이스 + builder.append(c); + } + } + return builder.toString(); + } +} From a16eece13c368fa911a7eb294c43b6992ffe6396 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:21:29 +0900 Subject: [PATCH 48/80] =?UTF-8?q?problem4=5FMain=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem4.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/onboarding/Problem4.java b/src/main/java/onboarding/Problem4.java index 9bc4334fa9..4c7c00e06f 100644 --- a/src/main/java/onboarding/Problem4.java +++ b/src/main/java/onboarding/Problem4.java @@ -1,7 +1,15 @@ package onboarding; +import problem4.WordValidation; +import problem4.ConvertWord; public class Problem4 { public static String solution(String word) { + WordValidation wordValidation = new WordValidation(); + if (wordValidation.ValidateWordLength(word)) { + ConvertWord convertWord = new ConvertWord(); + return convertWord.ConvertWord(word); + } + String answer = ""; return answer; } From 130fc53325a5affccb98bcb32a1b34cba6b1d8cf Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:21:54 +0900 Subject: [PATCH 49/80] =?UTF-8?q?problem4=5FTest=20Code=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 47cec90ec5..b8c9daabc6 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -60,40 +60,46 @@ class ApplicationTest { // } // } // +// @Nested +// class Problem3Test { +// @Test +// void case1() { +// int number = 13; +// int result = 4; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// int number = 33; +// int result = 14; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// +// @Test +// void case3() { +// int number = -1; +// int result = -1; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// } + @Nested - class Problem3Test { + class Problem4Test { @Test void case1() { - int number = 13; - int result = 4; - assertThat(Problem3.solution(number)).isEqualTo(result); + String word = "I love you"; + String result = "R olev blf"; + assertThat(Problem4.solution(word)).isEqualTo(result); } - @Test void case2() { - int number = 33; - int result = 14; - assertThat(Problem3.solution(number)).isEqualTo(result); - } - - @Test - void case3() { - int number = -1; - int result = -1; - assertThat(Problem3.solution(number)).isEqualTo(result); + String word = "abZ"; + String result = "ZYa"; + assertThat(Problem4.solution(word)).isEqualTo(result); } } -// @Nested -// class Problem4Test { -// @Test -// void case1() { -// String word = "I love you"; -// String result = "R olev blf"; -// assertThat(Problem4.solution(word)).isEqualTo(result); -// } -// } -// // @Nested // class Problem5Test { // @Test From 642943535032aa24eda570a4b3a36eaebb5c9d09 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:22:30 +0900 Subject: [PATCH 50/80] =?UTF-8?q?problem4=5FfunctionList.md=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(=EB=8C=80=EB=AC=B8=EC=9E=90=20>=20=EB=8C=80?= =?UTF-8?q?=EB=AC=B8=EC=9E=90=EB=A1=9C=20=EC=88=98=EC=A0=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/functionList.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/problem4/functionList.md b/src/main/java/problem4/functionList.md index 6663bac5a2..f96850fe55 100644 --- a/src/main/java/problem4/functionList.md +++ b/src/main/java/problem4/functionList.md @@ -6,6 +6,7 @@ ### 2. ConvertAlphabet > - 대문자가 들어 올 경우 -> - 'A' 는 'z' 로 +> - 'A' 는 'Z' 로 > - 소문자가 들어 올 경우 -> - 'z' 는 'A' 로 +> - 'z' 는 'a' 로 +> - 공백이 들어올 경우 From c45f7d0fe495341bea5e1d9ff9a38e336f1b07fb Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 10:56:44 +0900 Subject: [PATCH 51/80] =?UTF-8?q?yangyanghyunjung=EC=97=90=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A53=20=EB=AA=A9=EB=A1=9D=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/functionList3.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/main/java/problem3/functionList3.md diff --git a/src/main/java/problem3/functionList3.md b/src/main/java/problem3/functionList3.md new file mode 100644 index 0000000000..21dc91fc52 --- /dev/null +++ b/src/main/java/problem3/functionList3.md @@ -0,0 +1 @@ +# 🚀 problem3 기능목록 From df44936a30fa57f4e1e2d3fbb769cda8930494ac Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 10:58:38 +0900 Subject: [PATCH 52/80] =?UTF-8?q?yangyanghyunjung=EC=97=90=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A53=20=EB=AA=A9=EB=A1=9D=20=EC=BB=A4=EB=B0=8B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/functionList3.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/problem3/functionList3.md b/src/main/java/problem3/functionList3.md index 21dc91fc52..9ce7429d0d 100644 --- a/src/main/java/problem3/functionList3.md +++ b/src/main/java/problem3/functionList3.md @@ -1 +1,2 @@ # 🚀 problem3 기능목록 +[배달이가 좋아하는 369 게임] \ No newline at end of file From fbdcf89506e3d0d239d22cb6fdcc5bdd026ba9e1 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 11:04:16 +0900 Subject: [PATCH 53/80] =?UTF-8?q?yangyanghyunjung=EC=97=90=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A53=20=EB=AA=A9=EB=A1=9D=20=EC=BB=A4=EB=B0=8B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/functionList3.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/problem3/functionList3.md b/src/main/java/problem3/functionList3.md index 9ce7429d0d..21dc91fc52 100644 --- a/src/main/java/problem3/functionList3.md +++ b/src/main/java/problem3/functionList3.md @@ -1,2 +1 @@ # 🚀 problem3 기능목록 -[배달이가 좋아하는 369 게임] \ No newline at end of file From 80c51e930194eba98575dfa006bde56a74c1e2b9 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:04:46 +0900 Subject: [PATCH 54/80] =?UTF-8?q?problem3=20=EA=B8=B0=EB=8A=A5=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/functionList3.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/problem3/functionList3.md b/src/main/java/problem3/functionList3.md index 21dc91fc52..737d5fc9dd 100644 --- a/src/main/java/problem3/functionList3.md +++ b/src/main/java/problem3/functionList3.md @@ -1 +1,9 @@ # 🚀 problem3 기능목록 +- - - +**1. NumberValidation** +> - number이 1 이하 1000 이상일 경우 exception + +**2. ClapCount** +> - number에 3, 6, 9 가 포함 되면 : count++; +> - return count; +> - 3,6,9 가 n 번 포함 되어 있을 경우는 n번 counting \ No newline at end of file From f9628e573e67dacae794c54de62bfb24bc639253 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:05:19 +0900 Subject: [PATCH 55/80] =?UTF-8?q?problem3=5F=20NumberValidation=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/NumberValidation.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/problem3/NumberValidation.java diff --git a/src/main/java/problem3/NumberValidation.java b/src/main/java/problem3/NumberValidation.java new file mode 100644 index 0000000000..41edcd99f9 --- /dev/null +++ b/src/main/java/problem3/NumberValidation.java @@ -0,0 +1,12 @@ +package problem3; + +public class NumberValidation { + public int validateNumber (int number) { + if (number < 1 || number > 1000) { + System.out.println("1 이상 1000 이하의 숫자만 가능합니다."); + return -1; + } + ClapCount clapCount = new ClapCount(); + return clapCount.CountCalp(number); + } +} From 86ff47b71dc903e63f86996be35eee7a4d03f522 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:05:43 +0900 Subject: [PATCH 56/80] =?UTF-8?q?problem3=5F=20ClapCount=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/ClapCount.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/main/java/problem3/ClapCount.java diff --git a/src/main/java/problem3/ClapCount.java b/src/main/java/problem3/ClapCount.java new file mode 100644 index 0000000000..d3c8edd95a --- /dev/null +++ b/src/main/java/problem3/ClapCount.java @@ -0,0 +1,17 @@ +package problem3; + +public class ClapCount { + public int CountCalp(int number) { + int count = 0; + for (int i = 1; i <= number; ++i) { + String stringNumber = Integer.toString(i); + // 2번 이상일 경우 + for (int j = 0; j < stringNumber.length(); ++j){ + if (stringNumber.charAt(j) == '3' || stringNumber.charAt(j) == '6' || stringNumber.charAt(j) == '9') { + count++; + } + } + } + return count; + } +} From 7b5bb9b209707a80e8415aad6ffdea1286881ba6 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:06:31 +0900 Subject: [PATCH 57/80] =?UTF-8?q?problem3=5F=20Main=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem3.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/onboarding/Problem3.java b/src/main/java/onboarding/Problem3.java index 12e095d6e3..bb48bf82c1 100644 --- a/src/main/java/onboarding/Problem3.java +++ b/src/main/java/onboarding/Problem3.java @@ -1,8 +1,9 @@ package onboarding; +import problem3.NumberValidation; public class Problem3 { public static int solution(int number) { - int answer = 0; - return answer; + NumberValidation numberValidation = new NumberValidation(); + return numberValidation.validateNumber(number); } } From c755f1332c9cf3d06b235035c630cbbeb3846c8a Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 15:07:20 +0900 Subject: [PATCH 58/80] =?UTF-8?q?problem3=5F=20TestCode=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 107 ++++++++++-------- 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 0e8a82599f..47cec90ec5 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -8,75 +8,82 @@ import static org.assertj.core.api.Assertions.assertThat; class ApplicationTest { - @Nested - class Problem1Test { - @Test - void case1() { - List pobi = List.of(97, 98); - List crong = List.of(197, 198); - int result = 0; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - - @Test - void case2() { - List pobi = List.of(131, 132); - List crong = List.of(211, 212); - int result = 1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - - @Test - void case3() { - List pobi = List.of(99, 102); - List crong = List.of(211, 212); - int result = -1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - - @Test - void case4() { - List pobi = List.of(1,2); - List crong = List.of(399,400); - int result = -1; - assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); - } - } - // @Nested -// class Problem2Test { +// class Problem1Test { // @Test // void case1() { -// String cryptogram = "browoanoommnaon"; -// String result = "brown"; -// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// List pobi = List.of(97, 98); +// List crong = List.of(197, 198); +// int result = 0; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); // } // // @Test // void case2() { -// String cryptogram = "zyelleyz"; -// String result = ""; -// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); +// List pobi = List.of(131, 132); +// List crong = List.of(211, 212); +// int result = 1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// +// @Test +// void case3() { +// List pobi = List.of(99, 102); +// List crong = List.of(211, 212); +// int result = -1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); // } -// } // +// @Test +// void case4() { +// List pobi = List.of(1,2); +// List crong = List.of(399,400); +// int result = -1; +// assertThat(Problem1.solution(pobi, crong)).isEqualTo(result); +// } +// } + // @Nested -// class Problem3Test { +// class Problem2Test { // @Test // void case1() { -// int number = 13; -// int result = 4; -// assertThat(Problem3.solution(number)).isEqualTo(result); +// String cryptogram = "browoanoommnaon"; +// String result = "brown"; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); // } // // @Test // void case2() { -// int number = 33; -// int result = 14; -// assertThat(Problem3.solution(number)).isEqualTo(result); +// String cryptogram = "zyelleyz"; +// String result = ""; +// assertThat(Problem2.solution(cryptogram)).isEqualTo(result); // } // } // + @Nested + class Problem3Test { + @Test + void case1() { + int number = 13; + int result = 4; + assertThat(Problem3.solution(number)).isEqualTo(result); + } + + @Test + void case2() { + int number = 33; + int result = 14; + assertThat(Problem3.solution(number)).isEqualTo(result); + } + + @Test + void case3() { + int number = -1; + int result = -1; + assertThat(Problem3.solution(number)).isEqualTo(result); + } + } + // @Nested // class Problem4Test { // @Test From 10c982c448b22290be3bd882c215d760928e71be Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 17:07:05 +0900 Subject: [PATCH 59/80] =?UTF-8?q?problem3=5F=20jiyeong's=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=EB=A6=AC=EB=B7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem3/ClapCount.java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/problem3/ClapCount.java b/src/main/java/problem3/ClapCount.java index d3c8edd95a..34417f6cb3 100644 --- a/src/main/java/problem3/ClapCount.java +++ b/src/main/java/problem3/ClapCount.java @@ -3,15 +3,26 @@ public class ClapCount { public int CountCalp(int number) { int count = 0; - for (int i = 1; i <= number; ++i) { - String stringNumber = Integer.toString(i); - // 2번 이상일 경우 - for (int j = 0; j < stringNumber.length(); ++j){ - if (stringNumber.charAt(j) == '3' || stringNumber.charAt(j) == '6' || stringNumber.charAt(j) == '9') { +// for (int i = 1; i <= number; ++i) { +// String stringNumber = Integer.toString(i); +// // 2번 이상일 경우 +// for (int j = 0; j < stringNumber.length(); ++j){ +// if (stringNumber.charAt(j) == '3' || stringNumber.charAt(j) == '6' || stringNumber.charAt(j) == '9') { +// count++; +// } +// } +// } + //jiyeong's Code + (-48) + for (int i = 1; i < number + 1; ++i) { + String strNum = Integer.toString(i); + for (int j = 0; j < strNum.length(); ++j) { + int convertIntNum = strNum.charAt(j) - 48; + if (convertIntNum % 3 == 0 && convertIntNum != 0) { count++; } } } + return count; } } From 77b9660f89f2c74ee5508af383ad014b9d7c5554 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Tue, 17 Oct 2023 23:13:01 +0900 Subject: [PATCH 60/80] =?UTF-8?q?problem4=20=EA=B8=B0=EB=8A=A5=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/functionList.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/java/problem4/functionList.md diff --git a/src/main/java/problem4/functionList.md b/src/main/java/problem4/functionList.md new file mode 100644 index 0000000000..6663bac5a2 --- /dev/null +++ b/src/main/java/problem4/functionList.md @@ -0,0 +1,11 @@ +# 🚀 problem4 기능 목록 +- - - +### 1. WordLengthValidation +> - word 길이가 1 이하 1000 이상인 경우 +> - 알파벳 외의 문자가 들어 올 경우 + +### 2. ConvertAlphabet +> - 대문자가 들어 올 경우 +> - 'A' 는 'z' 로 +> - 소문자가 들어 올 경우 +> - 'z' 는 'A' 로 From 635fffcbfe5106dad8162cb4ef869e0587cab690 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:20:39 +0900 Subject: [PATCH 61/80] =?UTF-8?q?problem4=5FWordValidation=20=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/WordValidation.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main/java/problem4/WordValidation.java diff --git a/src/main/java/problem4/WordValidation.java b/src/main/java/problem4/WordValidation.java new file mode 100644 index 0000000000..66df4a5364 --- /dev/null +++ b/src/main/java/problem4/WordValidation.java @@ -0,0 +1,22 @@ +package problem4; + +public class WordValidation { + public boolean ValidateWordLength(String word) { + if (word.length() > 1 && word.length() < 1000) { + return ValidateAlphabet(word); + } + return false; + } + + public boolean ValidateAlphabet(String word) { + char[] wordCharArray = word.toCharArray(); + for (char c: wordCharArray) { + if (c < 56 && c > 123 && c != 32) { + throw new IllegalArgumentException("알파벳이 아닙니다"); + } else if (c > 90 && c < 97) { + throw new IllegalArgumentException("알파벳이 아닙니다"); + } + } + return true; + } +} From 196778e884a3a009ea16ce1e2ef52c34f02aa071 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:21:09 +0900 Subject: [PATCH 62/80] =?UTF-8?q?problem4=5FConvertWord=20=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/ConvertWord.java | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/main/java/problem4/ConvertWord.java diff --git a/src/main/java/problem4/ConvertWord.java b/src/main/java/problem4/ConvertWord.java new file mode 100644 index 0000000000..813d0f71ed --- /dev/null +++ b/src/main/java/problem4/ConvertWord.java @@ -0,0 +1,30 @@ +package problem4; + +public class ConvertWord { + public String ConvertWord(String word) { + char[] wordCharArray = word.toCharArray(); + StringBuilder builder = new StringBuilder(1024); + // 기준점 +// int A = 65; +// int Z = 90; +// int a = 97; +// int z = 123; + + // 이 부분 리팩토링 필요 !! 23/10/18 + for (char c: wordCharArray) { + if (c > 64 && c < 91) { + // 대문자 > 대문자 + int T = 90 - (c - 65); + builder.append((char)T); + } else if (c > 96 && c < 123) { + // 소문자 > 소문자 + int t = 122 - (c - 97); + builder.append((char)t); + } else if (c == 32) { + // 스페이스 + builder.append(c); + } + } + return builder.toString(); + } +} From 1fa2768a3e5acda91d90a7feab7e845d29ed2d58 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:21:29 +0900 Subject: [PATCH 63/80] =?UTF-8?q?problem4=5FMain=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem4.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/onboarding/Problem4.java b/src/main/java/onboarding/Problem4.java index 9bc4334fa9..4c7c00e06f 100644 --- a/src/main/java/onboarding/Problem4.java +++ b/src/main/java/onboarding/Problem4.java @@ -1,7 +1,15 @@ package onboarding; +import problem4.WordValidation; +import problem4.ConvertWord; public class Problem4 { public static String solution(String word) { + WordValidation wordValidation = new WordValidation(); + if (wordValidation.ValidateWordLength(word)) { + ConvertWord convertWord = new ConvertWord(); + return convertWord.ConvertWord(word); + } + String answer = ""; return answer; } From 7ed6048a6635a139723cc4365f7af36b6e1aa640 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:21:54 +0900 Subject: [PATCH 64/80] =?UTF-8?q?problem4=5FTest=20Code=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 47cec90ec5..b8c9daabc6 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -60,40 +60,46 @@ class ApplicationTest { // } // } // +// @Nested +// class Problem3Test { +// @Test +// void case1() { +// int number = 13; +// int result = 4; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// +// @Test +// void case2() { +// int number = 33; +// int result = 14; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// +// @Test +// void case3() { +// int number = -1; +// int result = -1; +// assertThat(Problem3.solution(number)).isEqualTo(result); +// } +// } + @Nested - class Problem3Test { + class Problem4Test { @Test void case1() { - int number = 13; - int result = 4; - assertThat(Problem3.solution(number)).isEqualTo(result); + String word = "I love you"; + String result = "R olev blf"; + assertThat(Problem4.solution(word)).isEqualTo(result); } - @Test void case2() { - int number = 33; - int result = 14; - assertThat(Problem3.solution(number)).isEqualTo(result); - } - - @Test - void case3() { - int number = -1; - int result = -1; - assertThat(Problem3.solution(number)).isEqualTo(result); + String word = "abZ"; + String result = "ZYa"; + assertThat(Problem4.solution(word)).isEqualTo(result); } } -// @Nested -// class Problem4Test { -// @Test -// void case1() { -// String word = "I love you"; -// String result = "R olev blf"; -// assertThat(Problem4.solution(word)).isEqualTo(result); -// } -// } -// // @Nested // class Problem5Test { // @Test From cf4fad2cc589e5eabb30abe428ca672280914a1a Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:22:30 +0900 Subject: [PATCH 65/80] =?UTF-8?q?problem4=5FfunctionList.md=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(=EB=8C=80=EB=AC=B8=EC=9E=90=20>=20=EB=8C=80?= =?UTF-8?q?=EB=AC=B8=EC=9E=90=EB=A1=9C=20=EC=88=98=EC=A0=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/functionList.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/problem4/functionList.md b/src/main/java/problem4/functionList.md index 6663bac5a2..f96850fe55 100644 --- a/src/main/java/problem4/functionList.md +++ b/src/main/java/problem4/functionList.md @@ -6,6 +6,7 @@ ### 2. ConvertAlphabet > - 대문자가 들어 올 경우 -> - 'A' 는 'z' 로 +> - 'A' 는 'Z' 로 > - 소문자가 들어 올 경우 -> - 'z' 는 'A' 로 +> - 'z' 는 'a' 로 +> - 공백이 들어올 경우 From c37121933715537f378c933061c6243af6d7a44d Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 00:38:48 +0900 Subject: [PATCH 66/80] =?UTF-8?q?=EC=9E=94=EB=94=94test=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/onboarding/ApplicationTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index b8c9daabc6..437ac1a671 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -94,6 +94,7 @@ void case1() { } @Test void case2() { + //test String word = "abZ"; String result = "ZYa"; assertThat(Problem4.solution(word)).isEqualTo(result); From d9c4ade880601b7d43b1371f181118ffde2ae788 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 08:44:18 +0900 Subject: [PATCH 67/80] =?UTF-8?q?problem4=5Fcom=EC=9A=A9=20README=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem4/functionList.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/main/java/problem4/functionList.md diff --git a/src/main/java/problem4/functionList.md b/src/main/java/problem4/functionList.md new file mode 100644 index 0000000000..1243f7a568 --- /dev/null +++ b/src/main/java/problem4/functionList.md @@ -0,0 +1,11 @@ +# 🚀 problem4 기능목록 +- - - +## 1. LengthValidation +> - word.length() 가 1 이하 1000 이상일 경우 +> - 알파벳이 아닌 경우 + +## 2. ConvertAlphabet +> - 대문자는 소문자 +> - 소문자는 대문자 +> - A는 z +> - z 는 A \ No newline at end of file From c1fe1e73b4238ce88e7c6d39959095a19cf26a36 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 12:30:39 +0900 Subject: [PATCH 68/80] =?UTF-8?q?problem4=5F2jun0=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem4.java | 2 +- src/main/java/problem4/ConvertWord.java | 62 +++++++++++++------ src/main/java/problem4/WordValidation.java | 28 +++++---- src/main/java/problem4/functionList.md | 2 +- src/test/java/onboarding/ApplicationTest.java | 9 ++- 5 files changed, 68 insertions(+), 35 deletions(-) diff --git a/src/main/java/onboarding/Problem4.java b/src/main/java/onboarding/Problem4.java index 4c7c00e06f..33490f6b62 100644 --- a/src/main/java/onboarding/Problem4.java +++ b/src/main/java/onboarding/Problem4.java @@ -7,7 +7,7 @@ public static String solution(String word) { WordValidation wordValidation = new WordValidation(); if (wordValidation.ValidateWordLength(word)) { ConvertWord convertWord = new ConvertWord(); - return convertWord.ConvertWord(word); + return convertWord.IsAlphabet(word); } String answer = ""; diff --git a/src/main/java/problem4/ConvertWord.java b/src/main/java/problem4/ConvertWord.java index 813d0f71ed..17084d562e 100644 --- a/src/main/java/problem4/ConvertWord.java +++ b/src/main/java/problem4/ConvertWord.java @@ -1,27 +1,49 @@ package problem4; public class ConvertWord { - public String ConvertWord(String word) { - char[] wordCharArray = word.toCharArray(); - StringBuilder builder = new StringBuilder(1024); - // 기준점 -// int A = 65; -// int Z = 90; -// int a = 97; -// int z = 123; +// public String ConvertWord(String word) { +// char[] wordCharArray = word.toCharArray(); // 미리 선언 vs for문에서 한 번에 처리 +// StringBuilder builder = new StringBuilder(1024); +// // 이 부분 리팩토링 필요 !! 23/10/18 +// for (char c: wordCharArray) { +// if (c > 64 && c < 91) { +// // 대문자 > 대문자 +// int T = 90 - (c - 65); +// builder.append((char)T); +// } else if (c > 96 && c < 123) { +// // 소문자 > 소문자 +// int t = 122 - (c - 97); +// builder.append((char)t); +// } else if (c == 32) { +// // 스페이스 +// builder.append(c); +// } +// } +// return builder.toString(); +// } + public char ConvertAlphabet(char c) { + char startIdx = ' '; + char lastIdx = ' '; - // 이 부분 리팩토링 필요 !! 23/10/18 - for (char c: wordCharArray) { - if (c > 64 && c < 91) { - // 대문자 > 대문자 - int T = 90 - (c - 65); - builder.append((char)T); - } else if (c > 96 && c < 123) { - // 소문자 > 소문자 - int t = 122 - (c - 97); - builder.append((char)t); - } else if (c == 32) { - // 스페이스 + // 대소문자 구분 + if (Character.isUpperCase(c)) { + startIdx = 'A'; // 대문자 + lastIdx = 'Z'; + } else { + startIdx = 'a'; // 소문자 + lastIdx = 'z'; + } + return (char)(lastIdx - (c - startIdx)); + } + public String IsAlphabet (String word) { + StringBuilder builder = new StringBuilder(1024); + // 2jun0 + me + for (char c: word.toCharArray()) { // 선언하지 않고 for문에서 한 번에 처리 + if (Character.isAlphabetic(c)) { + // 알파벳일 경우 convert + builder.append(ConvertAlphabet(c)); + } else { + // !, ' ', ~ 등등은 그대로 append builder.append(c); } } diff --git a/src/main/java/problem4/WordValidation.java b/src/main/java/problem4/WordValidation.java index 66df4a5364..c8fe7a2885 100644 --- a/src/main/java/problem4/WordValidation.java +++ b/src/main/java/problem4/WordValidation.java @@ -3,20 +3,24 @@ public class WordValidation { public boolean ValidateWordLength(String word) { if (word.length() > 1 && word.length() < 1000) { - return ValidateAlphabet(word); +// return ValidateAlphabet(word); + return true; } return false; } - public boolean ValidateAlphabet(String word) { - char[] wordCharArray = word.toCharArray(); - for (char c: wordCharArray) { - if (c < 56 && c > 123 && c != 32) { - throw new IllegalArgumentException("알파벳이 아닙니다"); - } else if (c > 90 && c < 97) { - throw new IllegalArgumentException("알파벳이 아닙니다"); - } - } - return true; - } + // 사실 여기서 하는게 의미가 없음 + // > 알파벳이 아니면 그냥 그대로 출력하는 것이기 때문에, 사용 안 하는게 아님. +// public boolean ValidateAlphabet(String word) { +// char[] wordCharArray = word.toCharArray(); // 선언하는 것 보다 for문에서 한번에 처리 가능함 +// for (char c: wordCharArray) { +// if (c < 56 && c > 123 && c != 32) { +// throw new IllegalArgumentException("알파벳이 아닙니다"); +// } else if (c > 90 && c < 97) { +// throw new IllegalArgumentException("알파벳이 아닙니다"); +// } +// } +// +// return true; +// } } diff --git a/src/main/java/problem4/functionList.md b/src/main/java/problem4/functionList.md index f96850fe55..95e2474135 100644 --- a/src/main/java/problem4/functionList.md +++ b/src/main/java/problem4/functionList.md @@ -9,4 +9,4 @@ > - 'A' 는 'Z' 로 > - 소문자가 들어 올 경우 > - 'z' 는 'a' 로 -> - 공백이 들어올 경우 +> - 공백, 문자가 들어올 경우 diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index b8c9daabc6..f7cea84c23 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -95,7 +95,14 @@ void case1() { @Test void case2() { String word = "abZ"; - String result = "ZYa"; + String result = "zyA"; + assertThat(Problem4.solution(word)).isEqualTo(result); + } + + @Test + void case3() { + String word = "Hello World!"; + String result = "Svool Dliow!"; assertThat(Problem4.solution(word)).isEqualTo(result); } } From 6e5b827efa654c7fbecd90f0691851c441f69e36 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:30:41 +0900 Subject: [PATCH 69/80] =?UTF-8?q?problem6=5F=EA=B8=B0=EB=8A=A5=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem6/functionList.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/main/java/problem6/functionList.md diff --git a/src/main/java/problem6/functionList.md b/src/main/java/problem6/functionList.md new file mode 100644 index 0000000000..1161a4b2fe --- /dev/null +++ b/src/main/java/problem6/functionList.md @@ -0,0 +1,19 @@ +# 🚀 problem6 기능 목록 +- - - +### 1. 유효성 체크 [ Validation ] +> - 크루가 1명 미만, 10000명 초과일 경우 +> - 이메일 전체 길이가 11자 미만, 20자 이상일 경우 +> - @email.com 가 없을 경우 +> - substring(eamil.length() - 10) +> - 닉네임이 한글이 아닐 경우, 1자 미만 20자 이상인 경우 + +### 2. 중복값 찾기 +> **이중 for문 사용** +> - 기준 요소를 잡고 해당 요소 닉네임.subString([i++], i + 2) +> - for문으로 모든 요소 훑으며 subString한 문자열 포함(contains()) 여부 확인 +> - 포함인 경우 Set을 사용해 중복 없이 이메일 추가 + +### 3. 이메일 오름차순 정렬 +```java +Arrays.sort(); // 오름차순 정렬 +``` \ No newline at end of file From 108c249b2272be3a2bf6fe224c8aa5699109066a Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:31:12 +0900 Subject: [PATCH 70/80] =?UTF-8?q?problem6=5F=20FindDuplicateNickname=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/problem6/FindDuplicateNickname.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/main/java/problem6/FindDuplicateNickname.java diff --git a/src/main/java/problem6/FindDuplicateNickname.java b/src/main/java/problem6/FindDuplicateNickname.java new file mode 100644 index 0000000000..cc71d45350 --- /dev/null +++ b/src/main/java/problem6/FindDuplicateNickname.java @@ -0,0 +1,34 @@ +package problem6; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class FindDuplicateNickname { + public List FindDuplicateNickname (List> forms) { + Set nickNameSet = new HashSet(); + ValidationCheck validationCheck = new ValidationCheck(); + + for (int i = 0; i < forms.size(); ++i) { + String nickName = forms.get(i).get(1); // 닉네임 + for (int j = 0; j < nickName.length() - 1; ++j) { + if (validationCheck.NicknameValidate(forms.get(j).get(1))) { + String substringNickName = ""; //마지막 OutOfBoundsException 방지 + if (j == nickName.length() - 1) { + substringNickName = nickName.substring(j); //마지막 OutOfBoundsException 방지 + } else { + substringNickName = nickName.substring(j, j + 2); // 2글자 추출 + } + for (int z = i + 1; z < forms.size(); ++z) { + String email = forms.get(z).get(0); + if ( validationCheck.EmailValidate(email) && email.contains(substringNickName)) { + nickNameSet.add(email); // 이메일 추가 + } + } + } + } + } + SortEmail sortEmail = new SortEmail(); + return sortEmail.SortEmail(nickNameSet); + } +} From 50aa7b40e3d90f6ea60e4b2f35dc84da31cdefba Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:31:38 +0900 Subject: [PATCH 71/80] =?UTF-8?q?problem6=5F=20SortEmail=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem6/SortEmail.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/problem6/SortEmail.java diff --git a/src/main/java/problem6/SortEmail.java b/src/main/java/problem6/SortEmail.java new file mode 100644 index 0000000000..1cca341ffa --- /dev/null +++ b/src/main/java/problem6/SortEmail.java @@ -0,0 +1,12 @@ +package problem6; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class SortEmail { + public List SortEmail(Set emailSet) { + List sortedEmail = emailSet.stream().sorted().collect(Collectors.toList()); + return sortedEmail; + } +} From 71e10e55cc684aecd29195c374eca7cbc7342000 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:31:56 +0900 Subject: [PATCH 72/80] problem6_ ValidationCheck --- src/main/java/problem6/ValidationCheck.java | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main/java/problem6/ValidationCheck.java diff --git a/src/main/java/problem6/ValidationCheck.java b/src/main/java/problem6/ValidationCheck.java new file mode 100644 index 0000000000..4a0164298e --- /dev/null +++ b/src/main/java/problem6/ValidationCheck.java @@ -0,0 +1,35 @@ +package problem6; + +import java.util.List; + +public class ValidationCheck { + // 크루원 수 check + public boolean MemberCountValidate(List> forms) { + if (forms.size() < 1 || forms.size() > 10000) { + return false; + } + return true; + } + // 이메일 길이, 도메인 일치 체크 + public boolean EmailValidate(String email) { + int length = email.length(); + + if (length < 11 || length > 19) { + return false; + } + if (email.substring(length - 10) != "@email.com") { + return false; + } + return true; + } + // 닉네임 한글 체크, 글자수 체크 + public boolean NicknameValidate(String nickname) { + if (nickname.length() < 1 || nickname.length() > 19) { + return false; + } + if (!nickname.matches(".*[ㄱ-ㅎㅏ-ㅣ가-힣]+.*")) { + return false; + } + return true; + } +} From 94884adbd685b66fcb499d52ae677f5b099b6e95 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:32:10 +0900 Subject: [PATCH 73/80] =?UTF-8?q?problem6=5F=20Main=ED=95=A8=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem6.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/onboarding/Problem6.java b/src/main/java/onboarding/Problem6.java index f6c7b32344..72d248a1b4 100644 --- a/src/main/java/onboarding/Problem6.java +++ b/src/main/java/onboarding/Problem6.java @@ -1,9 +1,19 @@ package onboarding; import java.util.List; +import problem6.FindDuplicateNickname; +import problem6.ValidationCheck; public class Problem6 { public static List solution(List> forms) { + ValidationCheck validationCheck = new ValidationCheck(); + FindDuplicateNickname findDuplicateNickname = new FindDuplicateNickname(); + + boolean validateMemberCount = validationCheck.MemberCountValidate(forms); + if (validateMemberCount) { + List reslut = findDuplicateNickname.FindDuplicateNickname(forms); + return reslut; + } List answer = List.of("answer"); return answer; } From 9d2882fd8eaca4eb5df3fc9089b85880d56b857f Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:32:26 +0900 Subject: [PATCH 74/80] problem6_ Test --- src/test/java/onboarding/ApplicationTest.java | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index f7cea84c23..419fb30f92 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -84,28 +84,28 @@ class ApplicationTest { // } // } - @Nested - class Problem4Test { - @Test - void case1() { - String word = "I love you"; - String result = "R olev blf"; - assertThat(Problem4.solution(word)).isEqualTo(result); - } - @Test - void case2() { - String word = "abZ"; - String result = "zyA"; - assertThat(Problem4.solution(word)).isEqualTo(result); - } - - @Test - void case3() { - String word = "Hello World!"; - String result = "Svool Dliow!"; - assertThat(Problem4.solution(word)).isEqualTo(result); - } - } +// @Nested +// class Problem4Test { +// @Test +// void case1() { +// String word = "I love you"; +// String result = "R olev blf"; +// assertThat(Problem4.solution(word)).isEqualTo(result); +// } +// @Test +// void case2() { +// String word = "abZ"; +// String result = "zyA"; +// assertThat(Problem4.solution(word)).isEqualTo(result); +// } +// +// @Test +// void case3() { +// String word = "Hello World!"; +// String result = "Svool Dliow!"; +// assertThat(Problem4.solution(word)).isEqualTo(result); +// } +// } // @Nested // class Problem5Test { @@ -123,23 +123,23 @@ void case3() { // assertThat(Problem5.solution(money)).isEqualTo(result); // } // } -// -// @Nested -// class Problem6Test { -// @Test -// void case1() { -// List> forms = List.of( -// List.of("jm@email.com", "제이엠"), -// List.of("jason@email.com", "제이슨"), -// List.of("woniee@email.com", "워니"), -// List.of("mj@email.com", "엠제이"), -// List.of("nowm@email.com", "이제엠") -// ); -// List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); -// assertThat(Problem6.solution(forms)).isEqualTo(result); -// } -// } -// + + @Nested + class Problem6Test { + @Test + void case1() { + List> forms = List.of( + List.of("jm@email.com", "제이엠"), + List.of("jason@email.com", "제이슨"), + List.of("woniee@email.com", "워니"), + List.of("mj@email.com", "엠제이"), + List.of("nowm@email.com", "이제엠") + ); + List result = List.of("jason@email.com", "jm@email.com", "mj@email.com"); + assertThat(Problem6.solution(forms)).isEqualTo(result); + } + } + // @Nested // class Problem7Test { // @Test From 8962f249632bb9b9cccaedd3cdc1e318211a9503 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 12:30:39 +0900 Subject: [PATCH 75/80] =?UTF-8?q?problem4=5F2jun0=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem4.java | 2 +- src/main/java/problem4/ConvertWord.java | 62 +++++++++++++------ src/main/java/problem4/WordValidation.java | 28 +++++---- src/main/java/problem4/functionList.md | 2 +- src/test/java/onboarding/ApplicationTest.java | 9 ++- 5 files changed, 68 insertions(+), 35 deletions(-) diff --git a/src/main/java/onboarding/Problem4.java b/src/main/java/onboarding/Problem4.java index 4c7c00e06f..33490f6b62 100644 --- a/src/main/java/onboarding/Problem4.java +++ b/src/main/java/onboarding/Problem4.java @@ -7,7 +7,7 @@ public static String solution(String word) { WordValidation wordValidation = new WordValidation(); if (wordValidation.ValidateWordLength(word)) { ConvertWord convertWord = new ConvertWord(); - return convertWord.ConvertWord(word); + return convertWord.IsAlphabet(word); } String answer = ""; diff --git a/src/main/java/problem4/ConvertWord.java b/src/main/java/problem4/ConvertWord.java index 813d0f71ed..17084d562e 100644 --- a/src/main/java/problem4/ConvertWord.java +++ b/src/main/java/problem4/ConvertWord.java @@ -1,27 +1,49 @@ package problem4; public class ConvertWord { - public String ConvertWord(String word) { - char[] wordCharArray = word.toCharArray(); - StringBuilder builder = new StringBuilder(1024); - // 기준점 -// int A = 65; -// int Z = 90; -// int a = 97; -// int z = 123; +// public String ConvertWord(String word) { +// char[] wordCharArray = word.toCharArray(); // 미리 선언 vs for문에서 한 번에 처리 +// StringBuilder builder = new StringBuilder(1024); +// // 이 부분 리팩토링 필요 !! 23/10/18 +// for (char c: wordCharArray) { +// if (c > 64 && c < 91) { +// // 대문자 > 대문자 +// int T = 90 - (c - 65); +// builder.append((char)T); +// } else if (c > 96 && c < 123) { +// // 소문자 > 소문자 +// int t = 122 - (c - 97); +// builder.append((char)t); +// } else if (c == 32) { +// // 스페이스 +// builder.append(c); +// } +// } +// return builder.toString(); +// } + public char ConvertAlphabet(char c) { + char startIdx = ' '; + char lastIdx = ' '; - // 이 부분 리팩토링 필요 !! 23/10/18 - for (char c: wordCharArray) { - if (c > 64 && c < 91) { - // 대문자 > 대문자 - int T = 90 - (c - 65); - builder.append((char)T); - } else if (c > 96 && c < 123) { - // 소문자 > 소문자 - int t = 122 - (c - 97); - builder.append((char)t); - } else if (c == 32) { - // 스페이스 + // 대소문자 구분 + if (Character.isUpperCase(c)) { + startIdx = 'A'; // 대문자 + lastIdx = 'Z'; + } else { + startIdx = 'a'; // 소문자 + lastIdx = 'z'; + } + return (char)(lastIdx - (c - startIdx)); + } + public String IsAlphabet (String word) { + StringBuilder builder = new StringBuilder(1024); + // 2jun0 + me + for (char c: word.toCharArray()) { // 선언하지 않고 for문에서 한 번에 처리 + if (Character.isAlphabetic(c)) { + // 알파벳일 경우 convert + builder.append(ConvertAlphabet(c)); + } else { + // !, ' ', ~ 등등은 그대로 append builder.append(c); } } diff --git a/src/main/java/problem4/WordValidation.java b/src/main/java/problem4/WordValidation.java index 66df4a5364..c8fe7a2885 100644 --- a/src/main/java/problem4/WordValidation.java +++ b/src/main/java/problem4/WordValidation.java @@ -3,20 +3,24 @@ public class WordValidation { public boolean ValidateWordLength(String word) { if (word.length() > 1 && word.length() < 1000) { - return ValidateAlphabet(word); +// return ValidateAlphabet(word); + return true; } return false; } - public boolean ValidateAlphabet(String word) { - char[] wordCharArray = word.toCharArray(); - for (char c: wordCharArray) { - if (c < 56 && c > 123 && c != 32) { - throw new IllegalArgumentException("알파벳이 아닙니다"); - } else if (c > 90 && c < 97) { - throw new IllegalArgumentException("알파벳이 아닙니다"); - } - } - return true; - } + // 사실 여기서 하는게 의미가 없음 + // > 알파벳이 아니면 그냥 그대로 출력하는 것이기 때문에, 사용 안 하는게 아님. +// public boolean ValidateAlphabet(String word) { +// char[] wordCharArray = word.toCharArray(); // 선언하는 것 보다 for문에서 한번에 처리 가능함 +// for (char c: wordCharArray) { +// if (c < 56 && c > 123 && c != 32) { +// throw new IllegalArgumentException("알파벳이 아닙니다"); +// } else if (c > 90 && c < 97) { +// throw new IllegalArgumentException("알파벳이 아닙니다"); +// } +// } +// +// return true; +// } } diff --git a/src/main/java/problem4/functionList.md b/src/main/java/problem4/functionList.md index f96850fe55..95e2474135 100644 --- a/src/main/java/problem4/functionList.md +++ b/src/main/java/problem4/functionList.md @@ -9,4 +9,4 @@ > - 'A' 는 'Z' 로 > - 소문자가 들어 올 경우 > - 'z' 는 'a' 로 -> - 공백이 들어올 경우 +> - 공백, 문자가 들어올 경우 diff --git a/src/test/java/onboarding/ApplicationTest.java b/src/test/java/onboarding/ApplicationTest.java index 437ac1a671..550dbb173b 100644 --- a/src/test/java/onboarding/ApplicationTest.java +++ b/src/test/java/onboarding/ApplicationTest.java @@ -96,7 +96,14 @@ void case1() { void case2() { //test String word = "abZ"; - String result = "ZYa"; + String result = "zyA"; + assertThat(Problem4.solution(word)).isEqualTo(result); + } + + @Test + void case3() { + String word = "Hello World!"; + String result = "Svool Dliow!"; assertThat(Problem4.solution(word)).isEqualTo(result); } } From 7566fb01e07fb1fb4933883eaf52172a119e62d2 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:30:41 +0900 Subject: [PATCH 76/80] =?UTF-8?q?problem6=5F=EA=B8=B0=EB=8A=A5=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem6/functionList.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/main/java/problem6/functionList.md diff --git a/src/main/java/problem6/functionList.md b/src/main/java/problem6/functionList.md new file mode 100644 index 0000000000..1161a4b2fe --- /dev/null +++ b/src/main/java/problem6/functionList.md @@ -0,0 +1,19 @@ +# 🚀 problem6 기능 목록 +- - - +### 1. 유효성 체크 [ Validation ] +> - 크루가 1명 미만, 10000명 초과일 경우 +> - 이메일 전체 길이가 11자 미만, 20자 이상일 경우 +> - @email.com 가 없을 경우 +> - substring(eamil.length() - 10) +> - 닉네임이 한글이 아닐 경우, 1자 미만 20자 이상인 경우 + +### 2. 중복값 찾기 +> **이중 for문 사용** +> - 기준 요소를 잡고 해당 요소 닉네임.subString([i++], i + 2) +> - for문으로 모든 요소 훑으며 subString한 문자열 포함(contains()) 여부 확인 +> - 포함인 경우 Set을 사용해 중복 없이 이메일 추가 + +### 3. 이메일 오름차순 정렬 +```java +Arrays.sort(); // 오름차순 정렬 +``` \ No newline at end of file From 6c16c1a7bcbb8a388d3e84e7c1a2f3496da4a357 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:31:12 +0900 Subject: [PATCH 77/80] =?UTF-8?q?problem6=5F=20FindDuplicateNickname=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/problem6/FindDuplicateNickname.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/main/java/problem6/FindDuplicateNickname.java diff --git a/src/main/java/problem6/FindDuplicateNickname.java b/src/main/java/problem6/FindDuplicateNickname.java new file mode 100644 index 0000000000..cc71d45350 --- /dev/null +++ b/src/main/java/problem6/FindDuplicateNickname.java @@ -0,0 +1,34 @@ +package problem6; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class FindDuplicateNickname { + public List FindDuplicateNickname (List> forms) { + Set nickNameSet = new HashSet(); + ValidationCheck validationCheck = new ValidationCheck(); + + for (int i = 0; i < forms.size(); ++i) { + String nickName = forms.get(i).get(1); // 닉네임 + for (int j = 0; j < nickName.length() - 1; ++j) { + if (validationCheck.NicknameValidate(forms.get(j).get(1))) { + String substringNickName = ""; //마지막 OutOfBoundsException 방지 + if (j == nickName.length() - 1) { + substringNickName = nickName.substring(j); //마지막 OutOfBoundsException 방지 + } else { + substringNickName = nickName.substring(j, j + 2); // 2글자 추출 + } + for (int z = i + 1; z < forms.size(); ++z) { + String email = forms.get(z).get(0); + if ( validationCheck.EmailValidate(email) && email.contains(substringNickName)) { + nickNameSet.add(email); // 이메일 추가 + } + } + } + } + } + SortEmail sortEmail = new SortEmail(); + return sortEmail.SortEmail(nickNameSet); + } +} From f3174f9765eed7ff41cc9f4469c6b79e806b9282 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:31:38 +0900 Subject: [PATCH 78/80] =?UTF-8?q?problem6=5F=20SortEmail=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/problem6/SortEmail.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/main/java/problem6/SortEmail.java diff --git a/src/main/java/problem6/SortEmail.java b/src/main/java/problem6/SortEmail.java new file mode 100644 index 0000000000..1cca341ffa --- /dev/null +++ b/src/main/java/problem6/SortEmail.java @@ -0,0 +1,12 @@ +package problem6; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class SortEmail { + public List SortEmail(Set emailSet) { + List sortedEmail = emailSet.stream().sorted().collect(Collectors.toList()); + return sortedEmail; + } +} From fd2699308c06b610a90ebf93e5faaf250cf4a552 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:31:56 +0900 Subject: [PATCH 79/80] problem6_ ValidationCheck --- src/main/java/problem6/ValidationCheck.java | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main/java/problem6/ValidationCheck.java diff --git a/src/main/java/problem6/ValidationCheck.java b/src/main/java/problem6/ValidationCheck.java new file mode 100644 index 0000000000..4a0164298e --- /dev/null +++ b/src/main/java/problem6/ValidationCheck.java @@ -0,0 +1,35 @@ +package problem6; + +import java.util.List; + +public class ValidationCheck { + // 크루원 수 check + public boolean MemberCountValidate(List> forms) { + if (forms.size() < 1 || forms.size() > 10000) { + return false; + } + return true; + } + // 이메일 길이, 도메인 일치 체크 + public boolean EmailValidate(String email) { + int length = email.length(); + + if (length < 11 || length > 19) { + return false; + } + if (email.substring(length - 10) != "@email.com") { + return false; + } + return true; + } + // 닉네임 한글 체크, 글자수 체크 + public boolean NicknameValidate(String nickname) { + if (nickname.length() < 1 || nickname.length() > 19) { + return false; + } + if (!nickname.matches(".*[ㄱ-ㅎㅏ-ㅣ가-힣]+.*")) { + return false; + } + return true; + } +} From 38cf945e381f6dff1a716b9d78748f0f14ce85b6 Mon Sep 17 00:00:00 2001 From: yangyanghyunjung Date: Wed, 18 Oct 2023 17:32:10 +0900 Subject: [PATCH 80/80] =?UTF-8?q?problem6=5F=20Main=ED=95=A8=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/onboarding/Problem6.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/onboarding/Problem6.java b/src/main/java/onboarding/Problem6.java index f6c7b32344..72d248a1b4 100644 --- a/src/main/java/onboarding/Problem6.java +++ b/src/main/java/onboarding/Problem6.java @@ -1,9 +1,19 @@ package onboarding; import java.util.List; +import problem6.FindDuplicateNickname; +import problem6.ValidationCheck; public class Problem6 { public static List solution(List> forms) { + ValidationCheck validationCheck = new ValidationCheck(); + FindDuplicateNickname findDuplicateNickname = new FindDuplicateNickname(); + + boolean validateMemberCount = validationCheck.MemberCountValidate(forms); + if (validateMemberCount) { + List reslut = findDuplicateNickname.FindDuplicateNickname(forms); + return reslut; + } List answer = List.of("answer"); return answer; }