Notice
Recent Posts
Recent Comments
«   2024/04   »
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
more
Archives
Today
Total
관리 메뉴

CHIqueen

[Intro] avoidObstacles 본문

프로그래밍/CodeSignal

[Intro] avoidObstacles

CHIqueen 2020. 3. 21. 15:49
def avoidObstacles(inputArray):
    return min([i for i in range(2, max(inputArray)+2) if all([j%i!=0 for j in inputArray])])

1이면 그냥 다 박고 가겠다는 거니까 2부터

그리고 나눴을때 나머지가 0이면 장애물이랑 부딪히는 거니까 버리기

'프로그래밍 > CodeSignal' 카테고리의 다른 글

[Intro] isIPv4Addres  (0) 2020.03.17
[Intro] arrayMaximalAdjacentDifference  (0) 2020.03.17
[Intro] areEquallyStrong  (0) 2020.03.17
[Intro] palindromeRearranging  (0) 2020.03.17
[Intro] Are Similar?  (0) 2020.03.17
Comments