Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.
Example:
Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excluding [11,22,33,44,55,66,77,88,99])
解法1:
一个排列组合的题目,注意一位的数有10种选择,而大于一位的数第一位只有9种。
用一个数组或者一个变量prev记录之前的结果简化运算。
C++
Java