본문 바로가기

ror_coding

검색하기
ror_coding
프로필사진 ro_rdil_31

  • Home (160)
    • Data Analysis (13)
      • Growth Hacking (7)
      • Tableau (6)
    • Coding Test (140)
      • Python (86)
      • SQL (54)
    • Certificate (5)
      • 빅데이터 분석 기사 (0)
      • SQLD (3)
      • ADsP (2)
Guestbook
Notice
Recent Posts
Recent Comments
Link
  • RoR's Github
«   2025/08   »
일 월 화 수 목 금 토
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
Tags
  • join
  • AARRR
  • 프로그래머스
  • hackerrank
  • programmers
  • 코테
  • 코딩
  • coding
  • coding test
  • counter
  • lv4
  • Growth hacking
  • time complexity
  • sql
  • Level2
  • Queue
  • cte
  • LeetCode
  • level4
  • python
  • itertools
  • 코딩테스트
  • 완전탐색
  • 조합
  • lambda
  • Stack
  • import re
  • mysql
  • tableau
  • 파이썬
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록most_common() (1)

ror_coding

[Programmers] 귤 고르기 - 138476

Counter 에서 값들을 기준으로 정렬하는 코드로 .most_common() 이 있다! Question 한 상자에 담으려는 귤의 개수 k와 귤의 크기를 담은 배열 tangerine이 매개변수로 주어집니다. 귤 k개를 고를 때 크기가 서로 다른 종류의 수의 최솟값을 return 하도록 solution 함수를 작성해주세요.  Code from collections import Counterdef solution(k, tangerine): cnt = 0 a = Counter(tangerine) for item, count in a.most_common(): k -= count cnt += 1 if k  now meOn my github

Coding Test/Python 2024. 10. 24. 12:29
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바