Skip to content
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

[Gotprgmer] Week 2 #738

Merged
merged 8 commits into from
Dec 21, 2024
Merged

[Gotprgmer] Week 2 #738

merged 8 commits into from
Dec 21, 2024

Conversation

GotPrgmer
Copy link
Contributor

@GotPrgmer GotPrgmer commented Dec 18, 2024

답안 제출 문제

체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@GotPrgmer GotPrgmer added the java label Dec 18, 2024
@GotPrgmer GotPrgmer self-assigned this Dec 18, 2024
@GotPrgmer GotPrgmer requested a review from a team as a code owner December 18, 2024 09:22
for(int j=i+1;j<nums.length;j++){
int checkNum = nums[i]+nums[j];
if(set.contains(-checkNum)){
numList = new ArrayList<>(Arrays.asList(nums[i], -checkNum, nums[j]));
Copy link
Contributor

Choose a reason for hiding this comment

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

List.of() 문법에 대해 찾아보시면
numList = List.of(nums[i], checkNum, nums[j]); 로 줄이실 수 있을거에요 :)
List.of의 단점은 immutable인 걸로 알고있습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

감사합니다!

Comment on lines +8 to +28
Map<Character,Integer> sMap = new HashMap<>();
Map<Character,Integer> tMap = new HashMap<>();
if(s.length() != t.length()){
return false;
}
for(int i=0;i<s.length();i++){
char sChar = s.charAt(i);
char tChar = t.charAt(i);
sMap.put(sChar,sMap.getOrDefault(sChar,0)+1);
tMap.put(tChar,tMap.getOrDefault(tChar,0)+1);
}
boolean flag = true;
for(char c:sMap.keySet()){
if(!sMap.getOrDefault(c,0).equals(tMap.getOrDefault(c,0))){
flag = false;
System.out.println(c);
break;
}
}

return flag;
Copy link
Contributor

Choose a reason for hiding this comment

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

String을 toCharArray()를 사용하여 char[] 로 만든 후,
Arrays.sort()를 사용 하여 정렬 한 뒤
Arrays.equals(sCharArray, tCharArray);
를 사용하는 방법도 있다는걸 알려드립니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

너무 감사해요 자바 알고 뉴비라서 이런 팁들이 필요한데 감사합니다.

Copy link
Contributor

@TonyKim9401 TonyKim9401 left a comment

Choose a reason for hiding this comment

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

2주차 문제풀이 고생 많으셨습니다!
문제에 따라 어떤 내용을 고민하셨는지, 어떻게 방향을 잡으셨는지 적어주셔서 리뷰할때 많은 도움이 되었습니다.
3주차도 파이팅입니다!

@GotPrgmer GotPrgmer merged commit f8a2b19 into DaleStudy:main Dec 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants