leetcode357
public class Solution {
public int CountNumbersWithUniqueDigits(int n) {
if (n == )
{
return ;
}
int res = ;
int uniqueDigits = ;
int availableNumber = ;
while (n-- > && availableNumber > )
{
uniqueDigits = uniqueDigits * availableNumber;
res += uniqueDigits;
availableNumber--;
}
return res;
}
}
https://leetcode.com/problems/count-numbers-with-unique-digits/#/description
leetcode357的更多相关文章
- [Swift]LeetCode357. 计算各个位数不同的数字个数 | Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Examp ...
随机推荐
- [转] Hiredis: redis c client使用注记
编译 使用 初始化 连接redis数据库 redisContext * pConn = redisConnect(redisIp.c_str(), redisPort);if (m_cLocal == ...
- [译]TLS中的RC4被攻破了,现在该怎么办?
原文链接:https://community.qualys.com/blogs/securitylabs/2013/03/19/rc4-in-tls-is-broken-now-what 原文发表时间 ...
- Unrecoverable error: corrupted cluster config file.
from: https://www.cnblogs.com/topicjie/p/7603227.html 缘起 正在欢乐的逗着孩子玩耍,突然间来了一通电话,值班人员告诉我误重启了一台服务器,是我负责 ...
- android 和主线程有关的小问题
1.在android 中 HTTP请求被不允许在主线程中执行,否则会抛出异常.如果请求时间过长,阻塞UI线程是一个非常差的体验之前,刚开始开发遇到这个问题,每次app运行到最后,发送网络请求就自己崩溃 ...
- webpack extract-text-webpack-plugin
备注: 提炼上面引用的css 1. 插件配置 const path = require("path"); const extracttextplugin = require( ...
- Linux CentOS6.5 命令修改网络配置
登陆成功后,编辑网络信息文件: 命令:vi /etc/sysconfig/network-scripts/ifcfg-eth0 修改配置如下图并保存,子网掩码.ip.默认网关根据自己网络进行调整: 永 ...
- PHP与理在事先
编程语言的应用选择,大家有各种各样的看法.高级语言有C,C++,C#,面向对象语言的典型代表Java是从信息电器发展的,因此有它的优势,也有它的局限.新编程语言族则有PHP,Ruby,Python,R ...
- 基于spring的异常一站式解决方案
https://segmentfault.com/a/1190000006749441#articleHeader4 https://lrwinx.github.io/2016/04/28/%E5%A ...
- RK3288 添加USB转虚拟串口设备
在系统开启并有日志打印的前提下,插入USB设备,就会打印USB设备和虚拟串口信息. 打印信息如下: 供应商ID(VID):idVendor=1234,产品ID(PID): idProduct=5678 ...
- 在同一服务器使用git分支建立线上 和 测试 项目
分支分配文件夹后 sourcetree 创建分支与合并 https://blog.csdn.net/qq_34975710/article/details/74469068 线上分支master 测试 ...