357.|357. Count Numbers with Unique Digits
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])
数每位都没有重复数字的个数
【357.|357. Count Numbers with Unique Digits】显然1 有10中选择, 2位数 第一位有9种, 第二位有9种, 总共有9*9
n==3: 前两位有9*9, 第三位有10-2 = 8 种选择总共9*9*8
以此类推
文章图片
推荐阅读
- Numbers的使用之—苹果手机如何编辑Excel
- MySQL之COUNT(*)性能到底如何()
- Scala WorkCount (null) entry in command string: null ls -F
- java线程并发控制同步工具CountDownLatch
- leetcode|leetcode 448. Find All Numbers Disappeared in an Array (简单)
- leetcode 204. Count Primes 计数质数 (Easy)
- Hadoop-Eclipse|Hadoop-Eclipse mapreduce测试WordCountMapReduce
- 面试|MySql统计函数COUNT详解
- English|Apple Unusually Offers Discounts in China Ahead of iPhone 14 Production
- 30行自己写并发工具类(Semaphore, CyclicBarrier, CountDownLatch)是什么体验()