전체 글 (204) 썸네일형 리스트형 코딜리티 lesson16 (greedy Algorithm), MaxNonoverlappingSegments, TieRopes MaxNonoverlappingSegments def solution(A, B): N = len(A) if N == 0: return 0 if N == 1: return 1 end_point = B[0] cnt = 1 for i in range(1, N): if end_point = K: line = 0 cnt += 1 return.. 코딜리티 lesson15 (Caterpillar method), AbsDistinct, CountDistinctSlices AbsDistinct Compute number of distinct absolute values of sorted array elements. [최초풀이] # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): res = set() for a in A: res.add(abs(a)) return len(res) CountDistinctSlices Count the number of distinct slices (containing only unique numbers). 코딜리티 lesson14, 이진탐색, MinMaxDivision(?), NailingPlanks(?) MinMaxDivision Divide array A into K blocks and minimize the largest sum of any block. 이전 1 ··· 45 46 47 48 49 50 51 ··· 68 다음