Skip to content

[WEEK09] 이배진#42

Merged
LeeBaeJin merged 4 commits into
mainfrom
bjlee
Apr 13, 2026
Merged

[WEEK09] 이배진#42
LeeBaeJin merged 4 commits into
mainfrom
bjlee

Conversation

@LeeBaeJin
Copy link
Copy Markdown
Collaborator

이렇게 풀었어요

1. 최댓값과 최솟값

  • 문제를 풀었어요.
  • 풀이 시간 : 8분

1) 복잡도 계산

시간복잡도: O(n)
공간복잡도: O(n)


2) 접근 아이디어

테스트 케이스가 문자열 타입(String) 임으로 인해 이를 Integer 타입과 배열로 변경해야 함으로, 빠른 타입 변경을 위해 Stream API 기술을 이용했습니다. 그리고 Max값과 Min값을 찾아내고, 답을 최솟값 + " " + 최댓값 으로 표현해야 하기 때문에 String 타입으로 다시 변경하여 답을 제출했습니다.




2. JadenCase 문자열 만들기

  • 문제를 풀었어요.
  • 풀이 시간 : 23분

1) 복잡도 계산

시간복잡도: O(n)
공간복잡도: O(n)


2) 접근 아이디어

테스트케이스를 보면 중간에 공백이 있기 때문에 우선, 문자열 타입 배열로 형 변환하여 처리하고 시작하였습니다. 그 후, 반복문을 선언하고 boolean 변수를 두어 첫 글자가 알파벳(문자) 라면 대문자 처리 + false 하고 그 후에 모두 소문자 처리 하였습니다.


3) 회고

더 짧은 코드로 해결할 수 있지 않을까 고민하다가 조금 시간이 길어졌습니다.



3. 올바른 괄호

  • 문제를 풀었어요.
  • 풀이 시간 : 53분

1) 복잡도 계산

시간복잡도: O(n)
공간복잡도: O(n)


2) 접근 아이디어

열림 괄호, 닫힘 괄호 여부를 판단하기 위해 우선 문자열 타입 배열로 형 변환을 먼저 해주었습니다. 반복문을 선언하고 카운트 변수를 선언한 후, 열림 괄호면 카운트를 올리고 닫힘 괄호면 카운트를 내렸습니다. 여기서 카운트가 음수가 된다면 이미 정상적이지 않은 괄호라고 판단하여 곧바로 false로 응답하고 루프 검사 후 양수가 되어도 정상적이지 않기 때문에 false를 응답합니다. 카운트가 0으로 맞춰진다면 정상 괄호라고 판단됨으로 true를 응답하면 되는 문제입니다.


3) 회고

처음에 문제 해결 방식에 대한 접근을 잘못했던 점이, 문자열의 ")" 이가 마지막에 나오고 그 앞에 "(" 이 있다면 해결될 것이라 생각에 매몰되어 이 접근 방법이 잘못됨을 느끼기 까지 시간이 걸렸었습니다. 유연한 사고를 하지 못한 점이 시간을 많이 소비 했다고 생각합니다.



@LeeBaeJin LeeBaeJin changed the title Bjlee 이배진 Apr 8, 2026
@doitchuu doitchuu changed the title 이배진 [WEEK09] 이배진 Apr 9, 2026
Copy link
Copy Markdown
Collaborator

@raejun92 raejun92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

}

static String solution(String s) {
int[] nums = Arrays.stream(s.split(" "))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지현님이 말씀하신 것처럼 자바에서는 작은 따음표랑 큰 따음표를 다르게 인식하는 것 같네요!
해당 답을 작은 따음표로 바꿔서 제출하면 String으로 바꿀 수 없다는 애러가 떠요

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 추가적으로 설명을 드리자면 아까 문자열 타입(String, char)에 대해서

큰따옴표 ("): String str = "Hello"; 와 같이 0개 이상의 문자를 포함하는 문자열에 사용.
작은따옴표 ('): char ch = 'A'; 와 같이 반드시 단 하나의 문자만 담을 때 사용.

차이점 또한 존재합니다! 이 부분 아까 PT할 때 설명누락된 점. 죄송합니다

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 예전에 풀었던 기억이 남아있어서 해당 아이디어를 떠올릴 수 있었는데 배진님은 아이디어를 생각해 내시다니 대단해요!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

직관적이라 이해하기 편하네요

Copy link
Copy Markdown
Collaborator

@sik9252 sik9252 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여러 언어로 코딩테스트 풀어보면서 자바가 입력/출력때도 적어야 할 부분이 많고 해서 포기했던 기억이 있는데 대단하십니다 ㅎㅎ 같이 열심히 해봐요!

Copy link
Copy Markdown
Member

@doitchuu doitchuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

점심시간에 잘 설명해주셔서 더 읽기 좋았던 것 같아요 👍 고생하셨습니다!

@LeeBaeJin LeeBaeJin merged commit 25071df into main Apr 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants