This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 100/25 % | |
| # https://codility.com/demo/results/trainingFXETBT-37D/ | |
| def solution(N, M): | |
| # write your code in Python 2.7 | |
| X = 0 | |
| count = 1 | |
| result = [0] | |
| while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1차 100/25 | |
| # https://codility.com/demo/results/training8VZAZX-573/ | |
| import bisect | |
| def solution(A): | |
| # write your code in Python 2.7 | |
| N = len(A) | |
| A2 = A[:] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://codility.com/demo/results/training3WQQR7-7GW/ | |
| def primality(n): | |
| i=2 | |
| while(i*i<=n): | |
| if (n % i == 0): | |
| return False | |
| i += 1 | |
| return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 100%/100% | |
| # 코드를 정리해야하는데. | |
| # https://codility.com/demo/results/trainingUZ442K-7GV/ | |
| def solution(A): | |
| # write your code in Python 2.7 | |
| N = len(A) | |
| if N < 3: | |
| return 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1차 시도 75% / 28% | |
| # https://codility.com/demo/results/training6CWMMR-TDG/ | |
| # 2차 시도 75% / 42% | |
| # https://codility.com/demo/results/trainingJ28BCV-GHW/ | |
| # 3차 100% / 100% | |
| # https://codility.com/demo/results/trainingSN3WBN-QAA/ | |
| def solution(A): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://codility.com/demo/results/trainingEYVYU7-76G/ | |
| import math | |
| def solution(N): | |
| if N <= 2: return N | |
| root = int(round(math.sqrt(N))) | |
| count = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://codility.com/demo/results/trainingQ8Y3XP-RGC/ | |
| def solution(A): | |
| # write your code in Python 2.7 | |
| N = len(A) | |
| if N < 2: | |
| return 0 | |
| lower = A[0] | |
| maxProfit = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # performance 100/100 | |
| # https://codility.com/demo/results/trainingRW2RK4-3UA/ | |
| def solution(A): | |
| # write your code in Python 2.7 | |
| max_ending = 0 | |
| max_slice = -2147483648 | |
| for a in A: | |
| max_ending = max(a, max_ending + a) | |
| max_slice = max(max_slice, max_ending) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # performance 100% | |
| # https://codility.com/demo/results/trainingAM667U-NCM/ | |
| NO_LEADER = -1000000001 | |
| # NO_LEADER = -1 | |
| def solution(A): | |
| # write your code in Python 2.7 | |
| N = len(A) | |
| if N < 2: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://codility.com/demo/results/trainingRF8B69-7SJ/ | |
| def solution(A): | |
| # write your code in Python 2.7 | |
| N = len(A) | |
| if N <= 1: | |
| return N-1 | |
| A2 = A[:] | |
| A2.sort() |