Skip to content

Largest Number

Given an integer n, return the largest number that contains exactly n digits.

Example

For n = 2, the output should be

largest_number(n) = 99

Solution

py
def largest_number(n):
    return int('9' * n)


print(largest_number(2))

my thoughts are neither my employer's nor my wife's