2021/10

[구명보트] My answer def solution(people, limit): answer = 0 people.sort() while(people!=[]): #wmin=min(people) wmin=people[0] #wmax=max(people) wmax=people[-1] if(wmin+wmax1): people=people[1:-1] #people.remove(wmin) #people.remove(wmax) else: people=people[1:] #people.remove(wmin) else: answer+=1 people=people[:-1] #people.remove(wmax) return answer ------------------------------------------------..
[7주차_입실 퇴실]-[위클리챌린지] My answer-시간초과 def solution(enter, leave): answer = [0]*len(enter) n=len(enter) for i in range(1,n+1): for j in range(1,n+1): if(i!=j): etmpi, etmpj=enter.index(i),enter.index(j) ltmpi, ltmpj=leave.index(i), leave.index(j) if(etmpi>etmpj and ltmpi
[방문 길이]-[Summer/Winter Coding(~2018)] My answer def solution(dirs): answer = set() posx,posy,tmpx,tmpy=0,0,0,0 for i in dirs: tmpx,tmpy=posx,posy if(i=='U' and posy!=5): posy+=1 elif(i=='D' and posy!=-5): posy-=1 elif(i=='R' and posx!=5): posx+=1 elif(i=='L' and posx!=-5): posx-=1 if((posx,posy)==(tmpx,tmpy)): continue answer.add((posx,posy,tmpx,tmpy)) answer.add((tmpx,tmpy,posx,posy)) return le..
[방금그곡]-[2018 KAKAO BLIND RECRUITMENT] My answer # 총 재생길이를 구해주는 함수 def timecalc(a,b): tmp,tmp2=[],[] tmp=a.split(':') tmp2=b.split(':') tmp=[int(i) for i in tmp] tmp2=[int(i) for i in tmp2] return (tmp2[0]-tmp[0])*60+tmp2[1]-tmp[1] '''#을 치환해주는 함수''' def substitution(a): alt={'C#':'H','D#':'I','F#':'J','G#':'K','A#':'L','E#':'M'} i=0 tmp="" while('#' in a): if(a[i]=='#'): tmp=a[i-1]+a[i] a=a[:i-1]..
창빵맨
'2021/10 글 목록