211124 수 Algorithms TIL

bongf·2021년 11월 24일
0

알고리즘TIL

목록 보기
35/153

프로그래머스 카카오 2018

뉴스클러스터링

프로그래머스 카카오 2019 (인턴십)

튜플

파이썬

  • other의 풀이가 더 간단하다
  • 나는 차집합으로 풀었다 (카카오도 해설에 차집합 내용이 나와있다)

자바

  • other의 풀이 good!
  • set에 add를 할 때 이미 있는 요소라면 true를, 없는 요소라면 false를 반환한다
    public static void main(String[] args) {
        Set<Integer> sets = new HashSet<>();
        sets.add(1);
        sets.add(2);
        sets.add(3);
        System.out.println(sets.add(4)); //true
        System.out.println(sets.add(1)); // false
    }
profile
spring, java학습

0개의 댓글