일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- EMR 구조
- freenom
- 스파크
- Spark 최적화
- 카프카
- Catalyst Optimizer
- 서버간 복사
- AWS Crawler
- 실행엔진
- 하둡
- 하둡2.0
- 데이터엔지니어링
- ORACLE문법
- 문맥교환
- 데이터 수집
- ORACLE MSSQL차이
- Spark
- 데이터베이스복사
- 지연연산
- 빌드도구
- 데이터파이프라인
- 프로그래머스 큰 수 만들기
- 하둡1.0
- 런타임데이터영역
- 하둡에코시스템
- kafka 설치
- Databricks
- lazy evaluation
- 프로그래머스
- 프로그래머스힙
- Today
- Total
목록알고리즘 (22)
띵유로그

최소 넓이는 9 이므로 세로는 최소=3 이다. 따라서 i=3부터 세로의 길이를 찾아서 탐색해나간다. 조건 1 : width를 i 로 나눴을떄 나누어 떨어져야함 조건 2 : (i-2) * (width/i-2) = yellow 여야 함 내 풀이 def solution(brown, yellow): answer = [] import math width=brown+yellow i=3 while i

내 풀이 def is_prime(num): if num==0 or num==1: return False for i in range(num-2): if num%(i+2)==0: return False return True def solution(numbers): answer = 0 import itertools num=[] for i in range(len(numbers)): num.extend(list(map(''.join, itertools.permutations(numbers,i+1)))) num=[int(i) for i in num] num=list(set(num)) print(num) for i in num: if is_prime(i): answer+=1 return answer 더 효율적인 풀이..

def solution(operations): answer = [] heap=[] max_heap=[] import heapq for op in operations: if op.split(" ")[0]=='I': num=int(op.split(" ")[1]) heapq.heappush(heap,num) heapq.heappush(max_heap,-num) else: if op.split(" ")[1]=='-1' and len(heap)!=0: heapq.heappop(heap) elif op.split(" ")[1]=='1' and len(heap)!=0: heapq.heappop(max_heap) max_heap=[-1*i for i in max_heap] heap=list(set(heap).inter..

내 풀이 def solution(answers): answer = [] cnt1=0 cnt2=0 cnt3=0 list1=[1,2,3,4,5] list2=[2,1,2,3,2,4,2,5] list3=[3, 3, 1, 1, 2, 2, 4, 4, 5, 5] for i in range(len(answers)): if answers[i]-list1[i%5]==0: cnt1+=1 if answers[i]-list2[i%8]==0: cnt2+=1 if answers[i]-list3[i%10]==0: cnt3+=1 corr=[cnt1,cnt2,cnt3] corr_max=max(corr) for i in range(len(corr)): if corr[i]==corr_max: answer.append(i+1) return ..

문제요약 : n 편의 논문중 h 번 이상 인용된 논문의 개수가 h개이상일때, h의 최댓값이 H-Index가 됨 내 풀이 def count(c_list, num): cnt=0 for i in c_list: if i>=num: cnt+=1 return cnt def solution(citations): answer = 0 citations=sorted(citations, reverse=True) for i in range(max(citations)): if max(citations)-i= l-i: return l-i return 0 - 정렬을 한 뒤에 citations[i] >= l -i를 통해 조건을 걸면 count함수를 굳이 만들 필요가 없다. 정렬을 했으면 당연히 i 보다 뒤에 있는 원소들은 i번째보다..
처음 풀이 : permutation을 이용한 완전 탐색 def solution(numbers): answer = '' from itertools import permutations case=[str(i) for i in numbers] cases=list(permutations(case,len(numbers))) joincases=["".join(i) for i in cases] sorted_case=sorted(joincases) answer=sorted_case[len(sorted_case)-1] return answer 위와 같이 itertools permutation 함수를 사용하니 직관적이면서 쉽게 답을 구했지만 시간초과로 fail이다. 연산자 오버로딩을 해야하나? 라는 생각이 들었다. 그런데,..
내 풀이 def solution(array, commands): answer = [] for i in commands: temp = array[i[0]-1:i[1]] temp.sort() answer.append(temp[i[2]-1]) return answer 주의할 점 1. 파이썬의 array[ i : j ]는 index i ~ j-1 까지를 return 한다. 2. .sort는 리스트의 내장함수로 None 반환 a=sorted(a)는 정렬한 list를 반환 -> a=temp.sort() 이런식으로 하면 None 다른사람 풀이 def solution(array, commands): return list(map(lambda x:sorted(array[x[0]-1:x[1]])[x[2]-1], comman..
내 풀이 def solution(scoville, K): answer = 0 import heapq heapq.heapify(scoville) while True: if scoville[0] >= K: break elif len(scoville) == 1: answer = -1 break f = heapq.heappop(scoville) s = heapq.heappop(scoville) mix = f + (s * 2) answer = answer + 1 heapq.heappush(scoville, mix) return answer 으악...완전 이상한 짓을 하고 있었다. 다 풀어놓고 헤멘 이유 두가지. 1. heap을 heqp로 오타 2. 음식을 섞을 떄 두번쨰로 덜 매운것에 가중*2가 된다는걸 잊었다...