leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0357.cpp (258B)


0 class Solution {
1 public:
2 int countNumbersWithUniqueDigits(const int n) const {
3 if (n == 0) return 1;
5 int res = 10, acc = 9, crnt = 9;
6 for (int i = 2; i <= n; i++)
7 res += acc *= crnt--;
9 return res;
10 }
11 };