【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 ...
随机推荐
- 在 windows 上安装 git 2.22
下载 by win 下载地址:https://git-scm.com/download/win 如下图.选择对应的版本下载: 安装 by win 1.双击下载好的git安装包.弹出提示框.如下图: 2 ...
- py停止工作
# 参考https://blog.csdn.net/w952470866/article/details/79132955 电脑搬动换了网络后打开pycharm显示停止工作解决办法: 将python. ...
- [ZJOI2009] 硬币游戏(找规律)
题目 洛谷传送门 题解 把1/21/21/2转化成0/10/10/1,所以直接可以异或. 对于长度为nnn的0/10/10/1数列,发现每变换2k(k>1)2^k(k>1)2k(k> ...
- python导包问题,这一篇就够了
解决办法: 将项目所在的根目录添加到sys.path中 在入口文件中加入如下代码: import sys import os # 将 项目的根目录添加到sys.path中 BASE_DIR = os. ...
- CSS 布局和 BFC
什么是 BFC 在一个Web页面的CSS渲染中,块级格式化上下文 (Block Fromatting Context)是按照块级盒子布局的.W3C对BFC的定义如下:浮动元素和绝对定位元素,非块级盒子 ...
- PHP爬虫之queryList
根据queryList 自己花了一个下午的时间写了一个爬星座数据的类,完全手写.附上代码 <?php require '../vendor/autoload.php'; use QL\Query ...
- php类的定义与实例化方法
php类的定义 类是对某个对象的定义.它包含有关对象动作方式的信息,包括它的名称.方法.属性和事件.实际上它本身并不是对象,因为它不存在于内存中.当引用类的代码运行时,类的一个新的实例,即对象,就在内 ...
- Laravel Repository Pattern
Laravel Repository Pattern The Repository Pattern can be very helpful to you in order to keep your ...
- 斜率dp的模板总结
#include<cstdio> #include<algorithm> using namespace std; long long sumt[40005],sum[4000 ...
- SDN与IXP
IXP 互联网交换中心(IXP)在互联网生态系统中发挥着关键作用.在全球范围内,100多个国家/地区有超过400个IXP,其中最大的IXP具有接近10 Tbps的峰值数据速率并连接数百个网络.IXP提 ...