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
def order(n): | |
return int(''.join(sorted(n, reverse=True))), int(''.join(sorted(n))) | |
def subtract(n, b): | |
k = len(n) | |
x, y = order(n) | |
difference = "" | |
borrow = 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
def solution(x, y): | |
worker_id = (((x + y - 2) * (x + y - 1)) / 2) + x | |
return str(worker_id) |
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
from math import sqrt | |
def get_factors(n): | |
factors = set() | |
for i in range(1, int(sqrt(n)) + 1): | |
if n % i == 0: | |
factors.update([i, n//i]) |