File tree 2 files changed +27
-0
lines changed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 82
82
451|[ Sort Characters By Frequency] ( ./0451-sort-characters-by-frequency.js ) |Medium|
83
83
459|[ Repeated Substring Pattern] ( ./0459-repeated-substring-pattern.js ) |Easy|
84
84
541|[ Reverse String II] ( ./0541-reverse-string-ii.js ) |Easy|
85
+ 551|[ Student Attendance Record I] ( ./0551-student-attendance-record-i.js ) |Easy|
85
86
565|[ Array Nesting] ( ./0565-array-nesting.js ) |Medium|
86
87
566|[ Reshape the Matrix] ( ./0566-reshape-the-matrix.js ) |Easy|
87
88
606|[ Construct String from Binary Tree] ( ./0606-construct-string-from-binary-tree.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 551. Student Attendance Record I
3
+ * https://leetcode.com/problems/student-attendance-record-i/
4
+ * Difficulty: Easy
5
+ *
6
+ * You are given a string s representing an attendance record for a student
7
+ * where each character signifies whether the student was absent, late, or
8
+ * present on that day. The record only contains the following three characters:
9
+ * - 'A': Absent.
10
+ * - 'L': Late.
11
+ * - 'P': Present.
12
+ *
13
+ * The student is eligible for an attendance award if they meet both of the following criteria:
14
+ * - The student was absent ('A') for strictly fewer than 2 days total.
15
+ * - The student was never late ('L') for 3 or more consecutive days.
16
+ *
17
+ * Return true if the student is eligible for an attendance award, or false otherwise.
18
+ */
19
+
20
+ /**
21
+ * @param {string } s
22
+ * @return {boolean }
23
+ */
24
+ var checkRecord = function ( s ) {
25
+ return ! s . includes ( 'LLL' ) && ( s . indexOf ( 'A' ) === s . lastIndexOf ( 'A' ) ) ;
26
+ } ;
You can’t perform that action at this time.
0 commit comments