Skip to content

Instantly share code, notes, and snippets.

View hazurd's full-sized avatar

Karl Dagenais hazurd

  • Montreal
View GitHub Profile
@hazurd
hazurd / recursive_constant_loop.py
Created April 26, 2020 19:06
Return the length of a constant loop given some conditions, an ID, and a given base
def solution(n, b):
k = len(n)
xc = sorted(n, reverse=True)
yc = sorted(n)
x = ''.join(xc)
y = ''.join(yc)
zc = int(x, base=b) - int(y, base=b)
z = str_base(zc, b)
if z in a:
return len(a) - a.index(z)
@hazurd
hazurd / unique_int_from_two_lists.py
Created April 25, 2020 15:20
Return a unique integer from a set of two lists
def solution(x, y):
unique = None
work_list = longest([x, y])
if work_list == x:
compare_list = y
else:
compare_list = x
for i in work_list:
if i not in compare_list: