LeetCode 357 Count Numbers with Unique Digits 题解
1.题目:
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])
题意:
输入一个数,找出这个数n中所有0 ≤ x < 10n.每个位置上数字都不相同的x的个数
2.解题思路:
排序取中间
3.代码
1 |
|