problem 551. Student Attendance Record I 题意: solution: class Solution { public: bool checkRecord(string s) { ; ; for(auto ch:s) { if('A'==ch) { ) return false;// cntL = ;// } else if('L' == ch) { ) return false;// } ;// } return true; } }; 理解题意很简单,重要…
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 正则表达式 统计 日期 题目地址:https://leetcode.com/problems/student-attendance-record-i/#/description 题目描述 You are given a string representing an attendance record for a student. The record…
题目如下: Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may be very large, return it after mod 109 + 7. A student attendance record is a string that only c…
551. Student Attendance Record I[easy] You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attend…
[抄题]: You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more…
▶ 一个学生的考勤状况是一个字符串,其中各字符的含义是:A 缺勤,L 迟到,P 正常.如果一个学生考勤状况中 A 不超过一个,且没有连续两个 L(L 可以有多个,但是不能连续),则称该学生达标(原文表述:A student could be rewarded if his attendance record doesn't contain more than one 'A' (absent) or more than two continuous 'L' (late). ) ▶ 551. 给定一…
You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more than o…
题目: You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more th…
You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more than o…
static int wing=[]() { std::ios::sync_with_stdio(false); cin.tie(NULL); ; }(); class Solution { public: bool checkRecord(string s) { ; int len=s.length(); ;i<len;i++) { if(s[i]=='A') countA++; if(s[i]=='L') { <len&&s[i+]==]=='L') return fals…
给定一个字符串来代表一个学生的出勤纪录,这个纪录仅包含以下三个字符:    'A' : Absent,缺勤    'L' : Late,迟到    'P' : Present,到场如果一个学生的出勤纪录中不超过一个'A'(缺勤)并且不超过两个连续的'L'(迟到),那么这个学生会被奖赏.你需要根据这个学生的出勤纪录判断他是否会被奖赏.示例 1:输入: "PPALLP"输出: True 示例 2:输入: "PPALLL"输出: False详见:https://leetc…
Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may be very large, return it after mod 109 + 7. A student attendance record is a string that only contain…
Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may be very large, return it after mod 109 + 7. A student attendance record is a string that only contain…
Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may be very large, return it after mod 109 + 7. A student attendance record is a string that only contain…
Given a positive integer n, return the number of all possible attendance records with length n, which will be regarded as rewardable. The answer may be very large, return it after mod 109 + 7. A student attendance record is a string that only contain…
问题 该文章的最新版本已迁移至个人博客[比特飞],单击链接 https://www.byteflying.com/archives/3953 访问. 给定一个字符串来代表一个学生的出勤纪录,这个纪录仅包含以下三个字符: 'A' : Absent,缺勤 'L' : Late,迟到 'P' : Present,到场 如果一个学生的出勤纪录中不超过一个'A'(缺勤)并且不超过两个连续的'L'(迟到),那么这个学生会被奖赏. 你需要根据这个学生的出勤纪录判断他是否会被奖赏. 输入: "PPALLP&qu…
You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more than o…
You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more than o…
这是悦乐书的第258次更新,第271篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第125题(顺位题号是551).您将获得一个表示学生出勤记录的字符串. 该记录仅包含以下三个字符: 'A':缺席. 'L':迟到. 'P':在场. 如果学生的出勤记录不超过一个"A"(缺席)或超过两个连续的"L"(迟到),则可以奖励学生.您需要返回学生是否可以根据他的出勤记录获得奖励.例如: 输入:"PPALLP" 输出:true 输入…
1.题目描述 You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more…
原题链接在这里:https://leetcode.com/problems/student-attendance-record-i/description/ 题目: You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Presen…
描述 You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more tha…
目录 Question Description Input Output Solution 解法1 Question Description 小明在公交车始发站上车,他应该在哪个站点下车才能最快到达学校?如果这样的站点存在多个选择距离学校最近的站点. 公交车始发站位置\((0,0)\),并且以恒定的速度\(v_b\)沿着\(X\)轴正向行驶 公交车有\(n\)个站点,每个站点的坐标不同,第\(i\)个站点的坐标是\((x_i,0)\) 公交车在站点的停靠时间可以忽略 学校的位置\((x_u,y_…
给定一个正整数 n,返回长度为 n 的所有可被视为可奖励的出勤记录的数量. 答案可能非常大,你只需返回结果mod 109 + 7的值.学生出勤记录是只包含以下三个字符的字符串:    1.'A' : Absent,缺勤    2.'L' : Late,迟到    3.'P' : Present,到场如果记录不包含多于一个'A'(缺勤)或超过两个连续的'L'(迟到),则该记录被视为可奖励的.示例:输入: n = 2输出: 8 解释:有8个长度为2的记录将被视为可奖励:"PP" , &qu…
题目描述 思路分析 测试用例 Java代码 代码链接 题目描述 输入一棵二叉树的根节点,求该树的深度.从根节点到叶节点依次经过的节点(含根.叶节点)形成树的一条路径,最长路径的长度为树的深度. 牛客网刷题地址 思路分析 利用递归,先计算左右子树的深度,判断左子树和右子树深度,大的+1 即为此二叉树的深度. 测试用例 功能测试:输入普通的二叉树;二叉树中所有节点都没有左/右子树. 特殊输入测试:二叉树只有一个节点;二叉树的头节点为nullptr指针. Java代码 public class Off…
problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完…
problem 1022. Sum of Root To Leaf Binary Numbers 参考 1. Leetcode_easy_1022. Sum of Root To Leaf Binary Numbers; 完…
problem 1025. Divisor Game 参考 1. Leetcode_easy_1025. Divisor Game; 完…
problem 1029. Two City Scheduling 参考 1. Leetcode_easy_1029. Two City Scheduling; 完…
problem 1030. Matrix Cells in Distance Order 参考 1. Leetcode_easy_1030. Matrix Cells in Distance Order; 完…