남남이루의 고군분투 🌳

  • 태그
  • 방명록
  • GIT Hub

list comprehension 1

[set, map, sum] 프로그래머스 lv1. 두 수의 합 (map이랑 sum 같이 쓰기!)

문제 리스트에서 두 개 뽑아서 더한 값을 오름차순으로 정렬해라. 문제 바로가기 내 풀이 from itertools import combinations def solution(n): comb = set(map(sum,(combinations(n, 2)))) return sorted(list(comb)) 결과 비슷한데, map없이 쓴 다른 사람 풀이 (list comprehension) : 더 느림, 같은 결과를 가져온다는 점만 배우면 된다. from itertools import combinations def solution(numbers): return sorted(set(sum(i) for i in list(combinations(numbers, 2)))) 결과 반환값의 형태는 list여야 해서 lis..

⚡️algorithm/master 2022.09.14
1
더보기
프로필사진

구구절절 개발블로그

  • Category (179)
    • Project (5)
    • Programming (36)
      • 💥 뽀개기 (1)
      • ☕ JavaScript (5)
      • 🧞‍♂️ React, TypeScript (6)
      • 🐍 Python (6)
      • 📚 Book Study (6)
      • 🌐 Web (3)
      • Tips (5)
    • ⚡️algorithm (98)
      • step-up ++ (6)
      • accepted (14)
      • master (1)
    • News (5)
      • Frontend (5)
      • Backend (0)
    • log ✎⁾⁾⁾ (30)
      • comming soon (0)
      • career (7)

Tag

Git, Set, DFS, 그래프, 책스터디, 프로그래머스, typescript, 이분탐색, 파이썬, Dictionary, ADHD, 알고리즘, DP, BFS, 더오래하면돼, combinations, 클린코드, 그리디, 부스트캠프, clean code,

Archives

«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

최근댓글

방문자수Total

  • Today :
  • Yesterday :
글쓰기 관리자 GitHub

Copyright © Kakao Corp. All rights reserved.

  • Github

티스토리툴바