[java-onboarding-week-1] roki.kim(김경록) 과제 제출합니다.#1
Open
KimGyeongLock wants to merge 15 commits intoJapring-Study:roki/java-onboarding-week-1from
Open
[java-onboarding-week-1] roki.kim(김경록) 과제 제출합니다.#1KimGyeongLock wants to merge 15 commits intoJapring-Study:roki/java-onboarding-week-1from
KimGyeongLock wants to merge 15 commits intoJapring-Study:roki/java-onboarding-week-1from
Conversation
yohanii
reviewed
Sep 3, 2024
Member
yohanii
left a comment
There was a problem hiding this comment.
고생 많으셨습니다! 👍
- 작은 함수 단위 분리
- if else문 줄이기 + 중간 탈출
- 네이밍
부분 신경 써주시면, 가독성이 더 좋아질 거 같아요!
Comment on lines
+11
to
+19
| if(pobi.size() != 2 || crong.size() != 2) { | ||
| return -1; | ||
| } | ||
| if(pobi.get(0) <= 1 || crong.get(0) <= 1 || pobi.get(1) >= 400 || crong.get(1) >= 400) { | ||
| return -1; | ||
| } | ||
| if(pobi.get(1) <= pobi.get(0) || pobi.get(1) - pobi.get(0) != 1 || crong.get(1) <= crong.get(0) || crong.get(1) - crong.get(0) != 1) { | ||
| return -1; | ||
| } |
Member
There was a problem hiding this comment.
검증과정을 따로 함수로 빼서, 모아서 보면 더 좋을 것 같아요!
Comment on lines
23
to
27
| if(pobiSum > crongSum) answer = 1; | ||
| else if(pobiSum < crongSum) answer = 2; | ||
| else answer = 0; | ||
|
|
||
| return answer; |
Member
There was a problem hiding this comment.
answer에 값을 넣어서 마지막에 리턴하는 것보다,
중간에 탈출할 수 있게하면 더 좋을 것 같습니다!
그리고 마지막 else는 제거할 수 있을 거 같아요
| return sum; | ||
| } | ||
|
|
||
| public static Integer plusMultiplyComp(Integer LR) { |
Member
There was a problem hiding this comment.
Comp가 무엇을 뜻하는지 잘 모르겠어서, 풀어서 쓰는 것도 좋을 것 같아요
LR보다 더 이해하기 좋은 네이밍이 있을 것 같아요! 저는 page라고 했어요
| } | ||
|
|
||
| public static Integer multiplyAll(List<Integer> allDigit) { | ||
| int sum = 1; |
| for (int i = 0; i < cryptogram.length() - 1; i++) { | ||
| if (cryptogram.charAt(i) == cryptogram.charAt(i + 1)) { | ||
| cryptogram = cryptogram.substring(0, i) + cryptogram.substring(i + 2); | ||
| i--; |
Member
There was a problem hiding this comment.
개인적으로 i를 바꾸는 것은 위험하다고 생각합니다!
i를 바꿔야한다면, for문 대신 while문이 더 괜찮을 거 같아요
|
|
||
| public class Problem7 { | ||
|
|
||
| static HashMap<String, Integer> map = new HashMap<>(); |
| List<String> userFriend = friendPoint(user, friends); | ||
| visitorPoint(visitors, userFriend); | ||
|
|
||
| List<Map.Entry<String, Integer>> entries = new ArrayList<>(map.entrySet()); |
| int valueComp = entry2.getValue().compareTo(entry1.getValue()); | ||
| if(valueComp == 0) { | ||
| return entry1.getKey().compareTo(entry2.getKey()); | ||
| } else { |
| return answer; | ||
| } | ||
|
|
||
| public static List<String> friendPoint(String user, List<List<String>> friends) { |
| } | ||
|
|
||
| public static void visitorPoint(List<String> visitors, List<String> userFriend) { | ||
| for(int i = 0; i < visitors.size(); i++) { |
Member
There was a problem hiding this comment.
index로 조회하는 것 보다 더 가독성 좋은 방법이 있습니다!
Suggested change
| for(int i = 0; i < visitors.size(); i++) { | |
| for(String visitor: visitors) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.