Coding Test/Codility (2) 썸네일형 리스트형 [Codility/파이썬] FloodDepth 문제 나의 풀이 def solution(A): peak, bottom = 0, 0 depth = 0 for altitude in A: if altitude > peak: depth = max(depth, peak - bottom) peak = altitude bottom = altitude elif altitude < bottom: bottom = altitude else: depth = max(depth, altitude - bottom) return depth 결과 [Codility/파이썬] LongestPassword 문제 나의 풀이 import re def solution(S): words = S.split(' ') answer = -1 for word in words: if not re.findall(r'[^A-Za-z0-9]', word): if len(re.findall(r'[A-Za-z]', word)) % 2 == 0: if len(re.findall(r'[0-9]', word)) % 2: answer = max(answer, len(word)) return answer 결과 이전 1 다음