Skip to content

Commit

Permalink
Solving new problem from Microsoft
Browse files Browse the repository at this point in the history
  • Loading branch information
dombroks committed Nov 9, 2020
1 parent cf69d28 commit bf67d39
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Microsoft_Problems/Microsoft_Problem_06.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
This problem was asked by Microsoft.
A number is considered perfect if its digits sum up to exactly 10.
Given a positive integer n, return the n-th perfect number.
For example, given 1, you should return 19. Given 2, you should return 28.
"""


def get_perfect_number(n):
if n <= 0:
return
return n * 10 + 10 - n


assert get_perfect_number(1) == 19
assert get_perfect_number(2) == 28
assert get_perfect_number(3) == 37

0 comments on commit bf67d39

Please sign in to comment.