美文网首页
357. Count Numbers with Unique D

357. Count Numbers with Unique D

作者: 我是你的果果呀 | 来源:发表于2016-12-08 12:39 被阅读0次

Given anon-negativeinteger 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中选择, 2位数 第一位有9种, 第二位有9种, 总共有9*9
n==3: 前两位有9*9, 第三位有10-2 = 8 种选择  总共9*9*8

以此类推

相关文章

网友评论

      本文标题:357. Count Numbers with Unique D

      本文链接:https://www.haomeiwen.com/subject/bsqsmttx.html