개발 블로그

고정 헤더 영역

글 제목

메뉴 레이어

개발 블로그

메뉴 리스트

  • 홈
  • 태그
  • 방명록
  • 분류 전체보기 (57)
    • Python (23)
    • kivy (0)
    • Terraform (3)
    • Cloud (1)
      • Kubernetes (1)
    • Coda (2)

검색 레이어

개발 블로그

검색 영역

컨텐츠 검색

분류 전체보기

  • [프로그래머스 코딩테스트 고득점 kit] h index python (reverse 풀이)

    2022.01.20 by yukmim

  • [프로그래머스 코딩테스트 고득점 kit] 가장 큰 수

    2022.01.17 by yukmim

  • [프로그래머스 코딩테스트 고득점 kit] 주식가격 queue로 풀기

    2022.01.15 by yukmim

  • [프로그래머스 코딩테스트 고득점 kit] 주식가격

    2022.01.15 by yukmim

  • [프로그래머스 코딩테스트 고득점 kit] 다리를 지나는 트럭

    2022.01.13 by yukmim

  • [프로그래머스 코딩테스트 고득점 kit] 프린터

    2022.01.13 by yukmim

  • [Python] 파이썬 올림 함수, 내림 함수, 반올림 함수

    2022.01.10 by yukmim

  • [프로그래머스 코딩테스트 kit] 전화번호부

    2022.01.10 by yukmim

[프로그래머스 코딩테스트 고득점 kit] h index python (reverse 풀이)

def solution(citations): answer = 0 citations.sort(reverse=True) for i in range(1, len(citations)+1): if citations[i-1] >= i: answer = i return answer 우리가 세어봐야할 인용수(h)의 수는 논문의 갯수가 len(citations)인 5개니, 최대 논문 인용수는 5개가 될것이고, 5회까지 인용수를 세어봐야한다. 각 논문 별 인용수가 담긴 리스트 citations = [3, 0, 6, 1, 5] 을 정렬한다. 리스트를 정렬하면 citations = [0, 1, 3, 5, 6]이 된다. 1회 이상 인용된 논문의 수(1과 같거나 큰 수)는 6,5,3,1 로 4개이다. 2회 이상 인용된 논문의 수..

카테고리 없음 2022. 1. 20. 15:23

[프로그래머스 코딩테스트 고득점 kit] 가장 큰 수

def solution(numbers): numbers = list(map(str, numbers)) numbers.sort(key = lambda x : x*3, reverse = True) answer = str(int(''.join(numbers))) return answer 바보 같은 나.. from collections import permutations 사용하면 시간복잡도가 n!이므로 무지무지 느리다 하나하나 찾아야되기 때문에 위와 같이 최대값만을 출력하는 함수를 구현해야한다

카테고리 없음 2022. 1. 17. 16:54

[프로그래머스 코딩테스트 고득점 kit] 주식가격 queue로 풀기

from collections import deque def solution(prices): answer = [] prices = deque(prices) while prices: value = 0 standard = prices.popleft() for i in prices: if standard > i: value += 1 break value += 1 answer.append(value) return answer

Python 2022. 1. 15. 19:42

[프로그래머스 코딩테스트 고득점 kit] 주식가격

def solution(prices): answer = [0]* len(prices) for i in range(len(prices)): for j in range(i+1, len(prices)): if prices[i]

카테고리 없음 2022. 1. 15. 19:09

[프로그래머스 코딩테스트 고득점 kit] 다리를 지나는 트럭

def solution(bridge_length, weight, truck_weights): answer = 0 bridge = [0] * bridge_length while len(bridge) != 0: answer += 1 bridge.pop(0) if len(truck_weights) != 0: if sum(bridge) + truck_weights[0]

카테고리 없음 2022. 1. 13. 18:48

[프로그래머스 코딩테스트 고득점 kit] 프린터

def solution(priorities, location): answer = 0 while len(priorities) != 0: if priorities[0] == max(priorities): answer += 1 priorities.pop(0) if location == 0: return answer else: location -= 1 else: priorities.append(priorities.pop(0)) if location == 0: location = len(priorities) - 1 else: location -= 1 return answer

카테고리 없음 2022. 1. 13. 17:16

[Python] 파이썬 올림 함수, 내림 함수, 반올림 함수

python에서 올림, 내림, 반올림 함수를 사용할 때는 math 모듈을 사용한다. import math 로 작성한다. ex)3.14 -> 3 a = 3.14 math.floor(a) ex) 3.14 -> 4 math.ceil(a) 반올림 함수는 round()를 사용하는데 사사오입원칙을 따른다고한다. 이해가 잘안가지만 .. 보통 0.5의 경우에는 올림 한다고 알고 있는데 round() 함수는 0.5일 경우 앞자리가 짝수일때는 내림 홀수일때는 올림 한다고한다(?).. ex) 3.5 -> 4 4.5 - > 3

카테고리 없음 2022. 1. 10. 16:31

[프로그래머스 코딩테스트 kit] 전화번호부

테스트 케이스 3개중 2개만 통과 import numpy as np def solution(phone_book): answer = [] phone_book = np.array(phone_book) check1 = phone_book[1][0:len(phone_book[1])+1] check2 = phone_book[2][0:len(phone_book[2])+1] if check1 == phone_book[1] and check2 == phone_book[2]: answer = False elif check1 == phoen_book[1] and check2 != phone_book[2]: answer = False elif check1 != phone_book[1] and check2 == phone_b..

카테고리 없음 2022. 1. 10. 16:12

추가 정보

인기글

최신글

페이징

이전
1 2 3 4 5 ··· 8
다음
TISTORY
개발 블로그 © Magazine Lab
페이스북 트위터 인스타그램 유투브 메일

티스토리툴바