-
Notifications
You must be signed in to change notification settings - Fork 126
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
[윤태권] Week1 문제 풀이 #317
[윤태권] Week1 문제 풀이 #317
Conversation
taekwon-dev
commented
Aug 12, 2024
•
edited
Loading
edited
- Contains Duplicate #217
- Number of 1 Bits #232
- Top K Frequent Elements #237
- Kth Smallest Element In a Bst #252
- Palindromic Substrings #267
contains-duplicate/taekwon-dev.java
Outdated
* - 데이터 순서 보장 필요 없음 | ||
*/ | ||
public boolean containsDuplicate(int[] nums) { | ||
HashSet<Integer> set = new HashSet<>(); |
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.
알고리즘과 관련없는 이야기인데
변수 선언을
Set<Integer> set = new HashSet<>();
으로 하는게 자바 컨벤션상 더 좋지 않을까 생각이 들었습니다.
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.
@dev-jonghoonpark 생각해보니까 interface 로 선언해두는 것이 나중에 다른 구현체로 갈아끼울 때도 더 유연하게 대응할 수 있을 것 같아서 더 좋을 것 같네요 ㅎㅎ 코멘트 감사합니다!
Note: 1주차 간단 후기
|
List<Map.Entry<Integer, Integer>> list = new ArrayList<>(map.entrySet()); | ||
list.sort(new Comparator<Map.Entry<Integer, Integer>>() { | ||
@Override | ||
public int compare(Map.Entry<Integer, Integer> e1, Map.Entry<Integer, Integer> e2) { | ||
return e2.getValue().compareTo(e1.getValue()); | ||
} | ||
}); |
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.
익명 클래스를 람다식으로 바꿔 보시는것도 좋을것 같아요 :)
마지막 문제였던 Palindromic Substring은 문자열을 각각 잘라서 앞,뒤를 비교하는 식으로 하면 어떨까요! |
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.
수고 많으셨습니다. 4문제만 푸셔도 충분히 잘 하신 거에요. 모임 전까지 PR 병합 부탁드리겠습니다.
|
||
return -1; | ||
} | ||
} |
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.
마지막 라인 브레이크가 누락된 파일이 디폴트 브랜치로 병합되지 않도록 각별히 주의 바랍니다. (참고: #334)