Sherlock and The Beast

  • + 0 comments

    Here is my Python solution!

    def decentNumber(n):
        nums = list(reversed([i for i in range(n // 3 + 1)]))
        for num in nums:
            if (n - (3 * num)) % 5 == 0:
                print(3 * num * "5" + (n - 3 * num) * "3")
                return
        print(-1)