【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 ...
随机推荐
- jenkins安装和国内镜像配置
直接替换 $JENKINS_HOME/updates/default.json 成腾讯云的地址即可: JENKINS_HOME=xxxxxxxxx sed -i 's/http:\/\/updates ...
- 题解[51nod1555] 布丁怪
题解[51nod1555] 布丁怪 题面 解析 本文参考这位dalao的题解 首先有一个巧妙的转换, 开一个数组记录每个横坐标的纵坐标, 简单来说就是对于点(x,y),令a[x]=y. 于是问题就变成 ...
- ipv4枯竭和ipv6的启用
IPv4是Internet Protocol version 4的缩写,中文翻译为互联网通信协议(TCP/IP协议)第四版,通常简称为网际协议版本4. IPv4使用32位(4字节)地址,因此地址空间中 ...
- 转,SqlServer 基础之(触发器)
概念: 触发器(trigger)是SQL server 提供给程序员和数据分析员来保证数据完整性的一种方法,它是与表事件相关的特殊的存储过程,它的执行不是由程序调用,也不是手工启动,而是由事件来触 ...
- 002_Python3 基础语法
1.注释 实例1: #!/usr/bin/python3 # 第一个注释 print("Hello, Python!") # 第二个注释 ****************** ...
- 三十三.mysqldump 实时增量备份 、innobackupex
1.数据库备份与恢复 逻辑备份工具 mysqldump 使用mysql 恢复数据库 1.1备份MySQL服务器上的所有库 ]# mysqldump -u root -p123456 --all-d ...
- CF707D Persistent Bookcase 可持久化线段树
维护一个二维零一矩阵(n,m<=1000),支持四种操作(不超过10^5次): 将(i,j)置一 将(i,j)置零 将第i行零一反转yu 回到第K次操作前的状态 每次操作后输出全局一共有多少个一 ...
- [JLOI2013]卡牌游戏 概率DP
[JLOI2013]卡牌游戏 概率DP 题面 \(dfs\)复杂度爆炸,考虑DP.发现决策时,我们只用关心当前玩家是从庄家数第几个玩家与当前抽到的牌是啥.于是设计状态\(f[i][j]\)表示有\(i ...
- 【概率论】5-1:分布介绍(Special Distribution Introduction)
title: [概率论]5-1:分布介绍(Special Distribution Introduction) categories: - Mathematic - Probability keywo ...
- Java 8的Time包常用API
Date.Canlender.SimpleDateFormat类在新的Time包面前几乎没有优势 日期LocalDate,时间LocalTime,日期时间LocalDateTime. 时区ZoneId ...