4. adjacentElementsProduct
def adjacentElementsProduct(inputArray):
return max([inputArray[i]*inputArray[i+1]for i in range(len(inputArray)-1)])
5. shapeArea
def shapeArea(n):
sum = 1
for i in range(n):
sum += 4*i
return sum
'알고리즘' 카테고리의 다른 글
[알고리즘] 7. almostIncreasingSequence (0) | 2021.05.01 |
---|---|
[알고리즘] 4/29 6. Make Array Consecutive 2 (0) | 2021.05.01 |
[algorithm] Intro (add / centuryFromYear / checkPalindrome) (0) | 2021.04.24 |
[알고리즘]단계별로 문제풀기 | if문 (백준/파이썬) (0) | 2021.03.19 |
[알고리즘] 알람시계(백준 2884/파이썬) (0) | 2021.03.19 |