Skip to content

Commit

Permalink
Aug18: ease use of C++17 features [E]
Browse files Browse the repository at this point in the history
LC551: use of ranges::count(s, 'A') < 2 and s.find("LLL") == string::npos
  • Loading branch information
aucker committed Aug 18, 2024
1 parent 81cdca7 commit 95be95d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ target/
.*

.clang-tidy

build/
16 changes: 16 additions & 0 deletions daily/Aug18.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <string>
using namespace std;

class Solution {
public:
/**
* @brief LC: 551: Student Attendance Record I [E]
* Just use the CPP feature, Time: O(N), Space: O(1)
*
* @param s
* @return true, false
*/
bool checkRecord(string s) {
return ranges::counts(s, 'A') && s.find("LLL") == string::npos;
}
};

0 comments on commit 95be95d

Please sign in to comment.