Problem Solving/리트코드(leetcode)
[Leetcode/C++] 551. Student Attendance Record I
높은곳에영광
2022. 1. 24. 01:34
class Solution {
public:
bool checkRecord(string s) {
return s.find("LLL") != string::npos || count(s.begin(), s.end(), 'A') > 1 ? false : true;
}
};
string에 내장되어있는 find 함수를 이용해 LLL을 찾았거나 결석(A) 가 2번이상이면 false를 리턴하도록 구현하였다.
stiring의 find 함수는 algorithm의 find 함수와 다르게 find(찾을문자, 시작점)을 주어준다.
문제: https://leetcode.com/problems/student-attendance-record-i/
Student Attendance Record I - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com