-
Notifications
You must be signed in to change notification settings - Fork 1
[WEEK09] 이배진 #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WEEK09] 이배진 #42
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| CLAUDE.md | ||
| .claude/ | ||
| .omc | ||
| .omc | ||
| .project | ||
|
|
||
| # Track only Java sources under LeeBJ | ||
| /LeeBJ/** | ||
| !/LeeBJ/src/ | ||
| !/LeeBJ/src/**/*.java |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * 프로그래머스 코딩테스트 문제 Lv.2 정답률 높은 순 기준 | ||
| * 문제명 : JadenCase 문자열 만들기 | ||
| * 날짜 : 2026 - 04 - 06 | ||
| * 풀이 시간 : 23분 | ||
| */ | ||
| public class JadenCaseString { | ||
| public static void main(String[] args) { | ||
| String testCase = "3people unFollowed me"; | ||
|
|
||
| String answer = solution(testCase); | ||
| System.out.println(answer); | ||
| } | ||
|
|
||
| static String solution(String s) { | ||
| char[] arr = s.toCharArray(); | ||
|
|
||
| boolean isStart = true; | ||
|
|
||
| for (int i = 0; i < arr.length; i++) { | ||
| if (arr[i] == ' ') { | ||
| isStart = true; | ||
| } else { | ||
| if (isStart) { | ||
| arr[i] = Character.toUpperCase(arr[i]); | ||
| isStart = false; | ||
| } else { | ||
| arr[i] = Character.toLowerCase(arr[i]); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| String answer = new String(arr); | ||
| return answer; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * 프로그래머스 코딩테스트 문제 Lv.2 정답률 높은 순 기준 | ||
| * 문제명 : 최댓값과 최솟값 | ||
| * 날짜 : 2026 - 04 - 06 | ||
| * 풀이 시간 : 8분 | ||
| */ | ||
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public class MaxValAndMinVal { | ||
| public static void main(String[] args) { | ||
| String testCase = "-2 -1 0 1 2"; | ||
|
|
||
| String answer = solution(testCase); | ||
| System.out.println(answer); | ||
| } | ||
|
|
||
| static String solution(String s) { | ||
| int[] nums = Arrays.stream(s.split(" ")) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 지현님이 말씀하신 것처럼 자바에서는 작은 따음표랑 큰 따음표를 다르게 인식하는 것 같네요!
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아 추가적으로 설명을 드리자면 아까 문자열 타입(String, char)에 대해서 큰따옴표 ("): String str = "Hello"; 와 같이 0개 이상의 문자를 포함하는 문자열에 사용. 차이점 또한 존재합니다! 이 부분 아까 PT할 때 설명누락된 점. 죄송합니다 |
||
| .mapToInt(Integer::parseInt) | ||
| .toArray(); | ||
|
|
||
| int maxVal = Arrays.stream(nums).max().getAsInt(); | ||
| int minVal = Arrays.stream(nums).min().getAsInt(); | ||
|
|
||
| String answer = minVal + " " + maxVal; | ||
| return answer; | ||
| } | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저는 예전에 풀었던 기억이 남아있어서 해당 아이디어를 떠올릴 수 있었는데 배진님은 아이디어를 생각해 내시다니 대단해요! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * 프로그래머스 코딩테스트 문제 Lv.2 정답률 높은 순 기준 | ||
| * 문제명 : 올바른 괄호 | ||
| * 날짜 : 2026 - 04 - 07 | ||
| * 풀이 시간 : 53분 | ||
| */ | ||
| public class ValidParentheses { | ||
| public static void main(String[] args) { | ||
| String testCase = "(()("; | ||
|
|
||
| boolean answer = solution(testCase); | ||
| System.out.println(answer); | ||
| } | ||
|
|
||
| static boolean solution(String s) { | ||
| char[] charArr = s.toCharArray(); | ||
|
|
||
| int count = 0; | ||
| for (char c : charArr) { | ||
| if (c == '(') { | ||
| count++; | ||
| } else { | ||
| count--; | ||
| } | ||
|
|
||
| // count가 음수면 바로 false 리턴 | ||
| if (count < 0) return false; | ||
| } | ||
|
|
||
| boolean answer = (count == 0); | ||
| return answer; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
직관적이라 이해하기 편하네요