Skip to content

Instantly share code, notes, and snippets.

View Victoria-Hodder's full-sized avatar

Victoria Hodder Victoria-Hodder

  • Berlin
View GitHub Profile
@Victoria-Hodder
Victoria-Hodder / ex2_jose.py
Last active September 3, 2020 15:26
ex2_Jose
"""
Write a function solution that, given integer N, returns the smallest non-negative
integer whose individual digits sum to N.
Examples:
1. Given N = 16, the function should return 79. There are many numbers whose
digits sum to 16 (for example: 79, 97, 808, 5551, 22822, etc.).
The smallest such number is 79.
class Matrix:
def __init__(self, matrix_string):
self.matrix_string = matrix_string
def row(self, index):
row = list(self.matrix_string.split("\n"))
return row[index]
"""
My logic is:
list1 = [-6, -91, 1011, -100, 84, -22, 0, 1, 473]
def solution(A):
answer = [num for num in A if num in range(-9,10)]
return max(answer)
print(solution(list1))