| 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 
| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 
| 23 | 24 | 25 | 26 | 27 | 28 | 29 | 
| 30 | 
                                        Tags
                                        
                                    
                                        
                                    - data_structure
 - codesingal
 - codesignal
 - collections.deque
 - recursion
 - C++
 - 파이썬 포렌식
 - 10953
 - All Longest Strings
 - Daily Commit
 - 피보나치 수
 - shapeArea
 - adjacentElementsProduct
 - Python
 - markdown
 - centuryFromYear
 - 2750
 - almostIncreasingSequence
 - til
 - 수 정렬하기
 - 2015 봄학기 알고리즘
 - Sequential Search
 - 파이썬머신러닝완벽가이드
 - Counting cells in a blob
 - matrixElementsSum
 - baekjun
 - Numpy
 - cpp
 - flask
 - 백준
 
                                        Archives
                                        
                                    
                                        
                                    - Today
 
- Total
 
Introfor
[Intro] adjacentElementsProduct 본문
Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.
주어진 정수 배열에서, 곱이 가장 큰 인접한 요소쌍을 찾아서 곱의 값을 반환한다.
def adjacentElementsProduct(inputArray):
    return max([inputArray[i] * inputArray[i + 1] for i in range(len(inputArray) - 1)])
각각의 인접한 요소쌍의 곱의 값들을 리스트에 저장하고, max()를 통해 최댓값을 구하여 반환한다.
'Programming_prob > Codesignal' 카테고리의 다른 글
| [Intro] Make Array Consecutive 2 (0) | 2020.07.18 | 
|---|---|
| [Intro] shapeArea (0) | 2020.07.18 | 
| [Intro] checkPalindrome (0) | 2020.07.18 | 
| [Intro] centuryFromYear (0) | 2020.07.18 | 
| [Intro] add (0) | 2020.07.18 | 
                          Comments