def main(): l1 = basics.getNumberList() l2 = basics.getNumberList() list1 = SLinkedList() list2 = SLinkedList() for i in range(0, len(l1)): list1.add_tail(l1[i]) for i in range(0, len(l2)): list2.add_tail(l2[i]) common_element = commonNode(list1, list2) print('First common element: ', common_element)
def main(): num_of_classes = basics.getNumber() schedule = [] for i in range(num_of_classes): interval = basics.getNumberList() if (len(interval) > 2): raise Exception('Only 2 numbers per interval..') schedule.append(interval) print(needed_rooms(schedule))
def main(): print('Number of houses: ') number_of_houses = basics.getNumber() print('Number of colors: ') number_of_colors = basics.getNumber() prices = [] for h in range(number_of_houses): print('House ', h, ' prices: ') colors = basics.getNumberList() if (len(colors) != number_of_colors): print('Input length not matching number of colors..') return prices.append(colors) print(prices) cheapestCombination(prices)
def main(): integers = basics.getNumberList() k = basics.getNumber() print(has_pair(integers, k))
def main(): assert compute([3, 2, 1]) == [2, 3, 6] assert compute([1, 2, 3, 4, 5]) == [120, 60, 40, 30, 24] input_list = basics.getNumberList() print(compute(input_list))
def main(): input = basics.getNumberList() printSubarrayMaxValues(input, 3)