Skip to content

Conversation

@dayaelee
Copy link
Member

@dayaelee dayaelee commented Sep 3, 2024

No description provided.

Copy link

@msung99 msung99 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 아이비!

Comment on lines +21 to +42
for (int i = 0; i < pleft.length(); i++){
char ch = pleft.charAt(i);
lsum += Character.getNumericValue(ch);
}
int lmulti = 1;
for (int i = 0; i < pleft.length(); i++){
char ch = pleft.charAt(i);
lmulti *= Character.getNumericValue(ch);
}

int rsum = 0;
for (int i = 0; i < pright.length(); i++){
char ch = pright.charAt(i);
rsum += Character.getNumericValue(ch);
}

int rmulti = 1;
for (int i = 0; i < pright.length(); i++){
char ch = pright.charAt(i);
rmulti *= Character.getNumericValue(ch);
}

Copy link

Choose a reason for hiding this comment

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

공통 관심사 및 유사한 코드에 대해 메소드로 분리하면 가독성이 좋아지지 않을까요? 🤔

Comment on lines +83 to +90
if (pmaxValue > cmaxValue){
answer = 1;
} else if (pmaxValue < cmaxValue) {
answer = 2;
} else {
answer = 0;
}

Copy link

Choose a reason for hiding this comment

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

객체지향 프로그래밍 관점에서 else 문의 사용을 지양하라 라는 지향 원칙이 있습니다. 이에 관련한 내용 찾아보셔도 좋을 것 같습니다!

Comment on lines +26 to +49
for(int j = 0; j<list.size(); j++){
for (int jj = 0; jj<friends.size(); jj++) {
List<String> target = friends.get(jj);
String target1 = target.get(0);
String target2 = target.get(1);

if (list.get(j).equals(target1)) {
if (map.containsKey(target2)) {
int tmpV = map.get(target2);
tmpV += 10;
map.put(target2, tmpV);
} else {
map.put(target2, 10);
}
} else if (list.get(j).equals(target2)) {
if (map.containsKey(target1)) {
int tmpV = map.get(target1);
tmpV += 10;
map.put(target1, tmpV);
} else {
map.put(target1, 10);
}
}
}
Copy link

@msung99 msung99 Sep 3, 2024

Choose a reason for hiding this comment

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

앞서 말씀 드렸던 내용과 동일한데, else 문을 지양하는게 좋습니다. else 문을 남용하면 자칫 중첩된 여러 조건문이 작성되고, 인덴트(들여쓰기)의 깊이가 늘어날 수 있기 때문입니다! if 절이 중첩되면서 동작흐름 파악이 힘든 Arrow Anti Pattern 이 전형적인 사례입니다.

https://haon.blog/haon/oop/principle-of-daily-gymnastics-front/

참고해보세요 ㅎㅎ

Comment on lines +57 to +70
for (int i = 0; i < cleft.length(); i++){
char ch = cleft.charAt(i);
clsum += Character.getNumericValue(ch);
}
int clmulti = 1;
for (int i = 0; i < cleft.length(); i++){
char ch = cleft.charAt(i);
clmulti *= Character.getNumericValue(ch);
}

int crsum = 0;
for (int i = 0; i < cright.length(); i++){
char ch = cright.charAt(i);
crsum += Character.getNumericValue(ch);
Copy link

Choose a reason for hiding this comment

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

전반적으로 모든 문제에서 for 문이 자주 사용되었는데, 가독성 개선을 위해 보통 stream API 기반 코드로 자주 대체하기도 합니다. 이와 관련하여 학습해보셔도 좋을 것 같습니다!

Comment on lines +91 to +94
Map<String, Integer> sortedMap = new LinkedHashMap<>();
for (Map.Entry<String, Integer> entry : entryList) {
sortedMap.put(entry.getKey(), entry.getValue());
}
Copy link

Choose a reason for hiding this comment

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

HashMap 대신 LinkedHashMap 을 선택하신 이유가 있나요?? 사용시 어떠한 장단점이 있을까요?

Copy link

@alreadysons alreadysons left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!

public static int solution(List<Integer> pobi, List<Integer> crong) {
int answer = Integer.MAX_VALUE;

String pleft = String.valueOf(pobi.get(0));

Choose a reason for hiding this comment

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

String 으로 하신 이유가 궁금합니다!

public static String solution(String cryptogram) {
String answer = "answer";
String tmp ="";
while (true) {

Choose a reason for hiding this comment

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

글자수로 반복문의 제한을 걸지않고 무한루프로 하신 이유가 궁금합니다!

public static List<String> solution(String user, List<List<String>> friends, List<String> visitors) {
List<String> answer = Collections.emptyList();

Map<String, Integer> map = new TreeMap<>();

Choose a reason for hiding this comment

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

TreeMap에 대한 설명혹시 가능할까요??

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.

3 participants