This file contains 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
#codility29 CountFactors | |
n = 24 | |
def solution(n) | |
factors = 0 |
This file contains 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
#Codility28 MinPerimeterRectangle | |
n = 25 | |
def solution(n) | |
xroot = n**(0.5) | |
if xroot%1 == 0 | |
answer = 4*xroot |
This file contains 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
#Codility27 MaxDoubleSliceSum | |
a = [3, 2, 6, -1, 4, 5, -1, 2] | |
def solution(a) | |
#t is the test triplets | |
#t = [0, 3, 6] |
This file contains 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
#Codility27 MaxDoubleSliceSum | |
a = [3, 2, 6, -1, 4, 5, -1, 2] | |
def solution(a) | |
#t is the test triplets | |
#t = [0, 3, 6] |
This file contains 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
#codility26 MaxSliceSum | |
a = [3, 2, -6, 4, 0] | |
def solution(a) | |
count = a.count |
This file contains 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
#codility25 MaxProfit | |
a = [23171, 21011, 21123, 21366, 21013, 21367] | |
#a = [4, 3, 2, 1] | |
def solution(a) | |
b = a.sort | |
count = a.count | |
parray = [] |
This file contains 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
#codility24 Dominator | |
a = [3, 4, 3, 2, 3, -1, 3, 3] | |
def solution(a) | |
b = [] | |
count = a.count | |
b = a.sort | |
dominator = b[a.count/2] |
This file contains 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
#codility23 EquiLeader | |
a = [4, 3, 4, 4, 4 ,2] | |
b= [] | |
def solution(a) | |
count = a.count | |
b = a.sort | |
leader = b[count/2] |
This file contains 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
#codality22 Fish | |
a = [4, 3, 2, 1, 5] | |
b = [0, 1, 0, 0, 0] | |
def solution(a, b) | |
numberoffish = a.count | |
fishup = b.index(1) |
This file contains 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
#Codility21 Nesting | |
#s = "(()(())())" | |
#s = "())" | |
s = "" | |
def solution(s) | |
output = 0 | |
length = s.length |