Skip to content

Instantly share code, notes, and snippets.

View dbhalling's full-sized avatar

Dale B Halling dbhalling

View GitHub Profile
@dbhalling
dbhalling / gist:e7560b076b69b5d0bbcd24323c1934bc
Last active August 24, 2018 09:29
#codility29 CountFactors
#codility29 CountFactors
n = 24
def solution(n)
factors = 0
@dbhalling
dbhalling / gist:6eac16ec2abec27c707601171ca2fb7b
Last active August 24, 2018 09:31
#Codility28 MinPerimeterRectangle
#Codility28 MinPerimeterRectangle
n = 25
def solution(n)
xroot = n**(0.5)
if xroot%1 == 0
answer = 4*xroot
@dbhalling
dbhalling / gist:1ed5b805c7d0c3c7ec7157463370c22a
Last active August 24, 2018 09:31
Codillity27 MaxDoubleSliceSum
#Codility27 MaxDoubleSliceSum
a = [3, 2, 6, -1, 4, 5, -1, 2]
def solution(a)
#t is the test triplets
#t = [0, 3, 6]
@dbhalling
dbhalling / gist:82ffa0af70431c11a1cbe27476cab553
Last active August 24, 2018 09:33
#Codility27 MaxDoubleSliceSum
#Codility27 MaxDoubleSliceSum
a = [3, 2, 6, -1, 4, 5, -1, 2]
def solution(a)
#t is the test triplets
#t = [0, 3, 6]
@dbhalling
dbhalling / gist:bceac12680b3387c582df311b8d468ca
Last active August 24, 2018 09:34
#codility26 MaxSliceSum
#codility26 MaxSliceSum
a = [3, 2, -6, 4, 0]
def solution(a)
count = a.count
@dbhalling
dbhalling / gist:7bbee80fcab92369d03b0683198239dd
Last active August 24, 2018 09:35
#codility25 MaxProfit
#codility25 MaxProfit
a = [23171, 21011, 21123, 21366, 21013, 21367]
#a = [4, 3, 2, 1]
def solution(a)
b = a.sort
count = a.count
parray = []
@dbhalling
dbhalling / gist:f6610e3a6a0e6c7f4d0514d5b4d7bdb9
Last active August 24, 2018 09:36
codility24 Dominator
#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]
@dbhalling
dbhalling / gist:f6603901dd753e3edcde5a8da14930d3
Last active August 24, 2018 09:36
Codility23 EquiLeader
#codility23 EquiLeader
a = [4, 3, 4, 4, 4 ,2]
b= []
def solution(a)
count = a.count
b = a.sort
leader = b[count/2]
#Codility21 Nesting
#s = "(()(())())"
#s = "())"
s = ""
def solution(s)
output = 0
length = s.length