코딩테스트/프로그래머스[Fail]

[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
[파일명 정렬]-[2018 KAKAO BLIND RECRUITMENT] My answer def solution(s): answer=[] tmp=[[ 0 for i in range(4)] for j in s] for index,i in enumerate(s): for j in range(len(i)): if(i[j].isdigit()==1): tmp[index][0]=i[:j].upper() for k in range(j,len(i)): tmp[index][3]=index if(k==len(i)-1): tmp[index][1]=int(i[j:]) break if(k==j+5 or i[k].isdigit()==0): tmp[index][1]=int(i[j:k]) tmp[index][2]=i[k:] brea..
[숫자 문자열과 영단어]-[2021 카카오 채용연계형 인턴십] My answer def solution(s): code=["zero","one","two","three","four","five","six","seven","eight","nine"] answer,tmp = "", "" for i in range(len(s)): if(s[i].isdigit()): answer+=s[i] else: tmp+=s[i] if(tmp!="" and tmp in code): for i in range(len(code)): if(tmp==code[i]): answer+=str(i) tmp="" return int(answer) Another answer num_dic = {"zero":"0", "one":"1", "t..
창빵맨
'코딩테스트/프로그래머스[Fail]' 카테고리의 글 목록