전체 글 (204) 썸네일형 리스트형 코딜리티 lesson10 CountFactors, MinPerimeterRectangle, Flags(?), Peaks(?) CountFactors -> 약수 개수 찾기 [참고풀이] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(N): cnt = 0 i = 0 while 1: i += 1 n = N % i #나머지 m = N//i #몫 if i > m: return cnt if n == 0: if i == m: cnt +=1 return cnt else: cnt += 2 return cnt MinPerimeterRectangle # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") de.. 코딜리티 lesson9 MaxProfit, MaxSliceSum, MaxDoubleSliceSum(?) MaxProfit [최초풀이] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): maxP = 0 for i in range(len(A)): for j in range(i+1, len(A)): if maxP < A[j]-A[i]: maxP = A[j]-A[i] return maxP [다른 풀이] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): if (len(A) == 1 ) or (len(A) == 0): return 0 mi.. 코딜리티 lesson8 Dominator, EquiLeader Dominator [최초풀이] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): if len(A) == 0: return -1 limitNum = len(A)/2 setA = set(A) ans = [] for x in setA: if A.count(x) > limitNum: ans.append(x) if len(ans) == 0: return -1 for y in ans: for i in range(len(A)): if y == A[i]: return i [다른풀이] # you can write to stdout for debugging purposes, e.g... 이전 1 ··· 47 48 49 50 51 52 53 ··· 68 다음