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
# Author: [email protected] | |
# zero-one knapsack implementation in python | |
items = { | |
'a': (12,4) | |
,'b':(10,6) | |
,'c':(8,5) | |
,'d':(11,7) | |
,'e':(14,3) |
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
# Author: [email protected] | |
# balanced partition problem | |
def solution(A): | |
a = list(map(abs,A)) # specific to codility problem | |
L = len(a) | |
if L == 1: | |
return a[0] | |
array_sum = sum(a) | |
half,m = divmod(array_sum,2) | |
#print(half,m) |
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
#!/usr/bin/env python3 | |
import csv | |
import sys | |
from collections import namedtuple | |
from datetime import datetime | |
Guarantee = namedtuple("Guarantee", "end_date address") | |
DEFAULT_CALCULATION_DATE = datetime(2020, 5, 2) | |
DEFULAT_FILE_NAME = "./guarantees_end.csv" |
OlderNewer