Largest number
Given an integer n, return the largest number that contains exactly n digits.
Example
For n = 2, the output should be solution(n) = 99.
Input
integer n
Guaranteed constraints: 1 ≤ n ≤ 9.
Output
The largest integer of length n.
Solution
Solution
rust
fn solution(n: i32) -> i32 {
10_i32.pow(n as u32) - 1
}
fn solution(n: i32) -> i32 {
10_i32.pow(n as u32) - 1
}