【Leetcode_easy】788. Rotated Digits
problem
solution1:
class Solution {
public:
int rotatedDigits(int N) {
int res = ;
for(int i=; i<=N; ++i)
{
if(check(i)) res++;
}
return res;
}
bool check(int num)
{
string str = to_string(num);
bool flag = false;
for(auto ch:str)
{
if(ch==''||ch==''||ch=='') return false;
if(ch==''||ch==''||ch==''||ch=='') flag = true;
}
return flag;
}
};
参考
1. Leetcode_easy_788. Rotated Digits;
2. Grandyang;
完
【Leetcode_easy】788. Rotated Digits的更多相关文章
- 【LeetCode】788. Rotated Digits 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...
- 【leetcode】1291. Sequential Digits
题目如下: An integer has sequential digits if and only if each digit in the number is one more than the ...
- 【Leetcode_easy】949. Largest Time for Given Digits
problem 949. Largest Time for Given Digits solution: class Solution { public: string largestTimeFrom ...
- LeetCode 788 Rotated Digits 解题报告
题目要求 X is a good number if after rotating each digit individually by 180 degrees, we get a valid num ...
- 【LeetCode】258. Add Digits (2 solutions)
Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only ...
- 【LeetCode】258. Add Digits
题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one di ...
- 788. Rotated Digits
X is a good number if after rotating each digit individually by 180 degrees, we get a valid number t ...
- #Leetcode# 788. Rotated Digits
https://leetcode.com/problems/rotated-digits/ X is a good number if after rotating each digit indivi ...
- [LeetCode&Python] Problem 788. Rotated Digits
X is a good number if after rotating each digit individually by 180 degrees, we get a valid number t ...
随机推荐
- Python基本的语法知识
1. 编程语言的介绍 低级语言:机器语言--------计算机内部只能接受二进制代码,故用0或者1表示的指令称为机器指令,全部的机器指令构成了计算机的机器语言. 汇编语言--------实质上跟机器语 ...
- 进程与线程与GIL的总结
- Jmeter逻辑控制之if控制器
一.背景 在实际工作中,当使用Jmeter做性能脚本或者接口脚本时,有可能会遇到需要对不同的条件做不同的操作,基于这种诉求,在Jmeter中可使用if控制器来实现 二.实际操作 逻辑控制器位置: 在线 ...
- 查看工程里有多少行java代码
/** * @Classname CustBankcardServiceImpl * @Description 计算项目代码量(行数) * @Date 2019/11/04 14:24 * @Crea ...
- 代码 | 自适应大邻域搜索系列之(5) - ALNS_Iteration_Status和ALNS_Parameters的代码解析
前言 上一篇推文说了,后面的代码难度直线下降,各位小伙伴可以放去n的100次方心了.今天讲讲一些细枝末节,就是前面一直有提到的参数和一些状态的记录代码.这个简单啦,小编也不作过多解释了.大家直接看代码 ...
- Python3条件判断
if语句: Python中if语句的一般形式如下: if condition_1: statement_block_1 elif condition_2: statement_block_2 else ...
- ROS常用工具
先将这个package放到工作空间的 src 目录中, 链接:点击打开链接 密码:u98p 然后在工作空间中加入依赖, rosdep install --from-paths src --ignore ...
- P1966 火柴排队——逆序对(归并,树状数组)
P1966 火柴排队 很好的逆序对板子题: 求的是(x1-x2)*(x1-x2)的最小值: x1*x1+x2*x2-2*x1*x2 让x1*x2最大即可: 可以证明将b,c数组排序后,一一对应的状态是 ...
- codeforces396C
On Changing Tree CodeForces - 396C You are given a rooted tree consisting of n vertices numbered fro ...
- jenkins之docker安装(jenkins/jenkins:lts)
建议使用此镜像安装,不要使用官网推荐的jenkinsci/blueocean镜像,使用它构建node程序会出现问题. 1.宿主服务器jenkins_home目录权限 为了方便安装插件,升级,迁移,因此 ...