problem

788. Rotated Digits

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的更多相关文章

  1. 【LeetCode】788. Rotated Digits 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...

  2. 【leetcode】1291. Sequential Digits

    题目如下: An integer has sequential digits if and only if each digit in the number is one more than the ...

  3. 【Leetcode_easy】949. Largest Time for Given Digits

    problem 949. Largest Time for Given Digits solution: class Solution { public: string largestTimeFrom ...

  4. LeetCode 788 Rotated Digits 解题报告

    题目要求 X is a good number if after rotating each digit individually by 180 degrees, we get a valid num ...

  5. 【LeetCode】258. Add Digits (2 solutions)

    Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only ...

  6. 【LeetCode】258. Add Digits

    题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one di ...

  7. 788. Rotated Digits

    X is a good number if after rotating each digit individually by 180 degrees, we get a valid number t ...

  8. #Leetcode# 788. Rotated Digits

    https://leetcode.com/problems/rotated-digits/ X is a good number if after rotating each digit indivi ...

  9. [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 ...

随机推荐

  1. python----装饰器(几种常见方式的使用与理解)

    更详细的装饰器,真心实力推荐,里面介绍的很清楚,介绍可见链接:https://blog.csdn.net/buster_zr/article/details/81104551 1.装饰器的理论: (1 ...

  2. ORACLE数据库误操作执行了DELETE,该如何恢复数据?

    ORACLE数据库误操作执行了DELETE,该如何恢复数据? 原创 2016年08月11日 17:23:04 10517 作为一个程序员,数据库操作是必须的,但是如果操作失误,一般都会造成比较严重的后 ...

  3. MySQL 优化--持续整理

    一.innodb体系结构优化: 1.IO优化 IO能力不足时 innodb_io_capacity 应该降低 innodb_max_dirty_pages_pct 应该降低 innodb_max_di ...

  4. Crontab 定时任务格式参数

    crontab 定时执行 任务 格式: * * * * *-) 小时(-) 日(-) 月份(-) 星期(-6) 星号(*):代表所有可能的值,例如month字段如果是星号,则表示在满足其它字段的制约条 ...

  5. Codeforces 221d D. Little Elephant and Array

    二次联通门 : Codeforces 221d D. Little Elephant and Array /* Codeforces 221d D. Little Elephant and Array ...

  6. C++类*类型和其他类型相互转换

    类类型转换时会出现两种之间转换,下面我们说的是类类型 1.其他类型转换为本类类型 通过类带一个参数的构造函数:或者多个参数构造函数,除了第一个参数后面参数都有默认值时!这样在其他类型赋值给该类类型对象 ...

  7. linux 查询cpu版本、核心、线程脚本

    #!/bin/bash #1.查看物理cpu个数 physical=`cat /proc/cpuinfo |grep 'physical id'|sort -u|wc -l` echo 物理cpu个数 ...

  8. 计蒜客 UCloud 的安全秘钥 ——(hash)

    题目链接:https://nanti.jisuanke.com/t/15769. 题意是求可以变换位置以后相同的子串有多少个,那么做法是只要每个数字的平方和,立方和以及四次方和都相同就可以了. 代码如 ...

  9. ssh刚连接到其他服务器就闪退的问题。Connection to slave1 closed

    问题现象: 由于最近在docker上部署hadoop,最开始搭建完以后,ssh是正常的,当我重启系统以后就出现了上面的这个问题 解决: 修改配置文件:/etc/ssh/sshd_config 把Per ...

  10. Centos7使用python3连接inception报错解决办法

    inception支持mysqldb库但不支持pymysql库,无奈mysqldb库不兼容py3,直接使用pymysql 连接inception报错如下: ValueError: invalid li ...