Skip to content

Commit 4a46446

Browse files
committedMar 22, 2021
feat: add solutions to leetcode problem: No.0551
551. Student Attendance Record I
1 parent 7885773 commit 4a46446

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
- [只出现一次的数字 II](/solution/0100-0199/0137.Single%20Number%20II/README.md)
124124
- [只出现一次的数字 III](/solution/0200-0299/0260.Single%20Number%20III/README.md)
125125
- [错误的集合](/solution/0600-0699/0645.Set%20Mismatch/README.md)
126-
- [二进制中 1 的个数](/lcof/面试题15.%20二进制中1的个数/README.md)
126+
- [ 1 的个数](/solution/0100-0199/0191.Number%20of%201%20Bits/README.md)
127127
- [计数质数](/solution/0200-0299/0204.Count%20Primes/README.md)
128128
- [不用加减乘除做加法](/lcof/面试题65.%20不用加减乘除做加法/README.md)
129129
- [丢失的数字](/solution/0200-0299/0268.Missing%20Number/README.md)

‎README_EN.md

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Complete solutions to [LeetCode](https://leetcode-cn.com/problemset/all/), [LCOF
119119
- [Single Number II](/solution/0100-0199/0137.Single%20Number%20II/README_EN.md)
120120
- [Single Number III](/solution/0200-0299/0260.Single%20Number%20III/README_EN.md)
121121
- [Set Mismatch](/solution/0600-0699/0645.Set%20Mismatch/README_EN.md)
122+
- [Number of 1 Bits](/solution/0100-0199/0191.Number%20of%201%20Bits/README_EN.md)
122123
- [Count Primes](/solution/0200-0299/0204.Count%20Primes/README_EN.md)
123124
- [Missing Number](/solution/0200-0299/0268.Missing%20Number/README_EN.md)
124125

‎solution/0500-0599/0551.Student Attendance Record I/README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,22 @@
4040
<!-- 这里可写当前语言的特殊实现逻辑 -->
4141

4242
```python
43-
43+
class Solution:
44+
def checkRecord(self, s: str) -> bool:
45+
return s.count('A') <= 1 and 'LLL' not in s
4446
```
4547

4648
### **Java**
4749

4850
<!-- 这里可写当前语言的特殊实现逻辑 -->
4951

5052
```java
51-
53+
class Solution {
54+
public boolean checkRecord(String s) {
55+
int i = s.indexOf("A");
56+
return (i == -1 || s.lastIndexOf("A") == i) && !s.contains("LLL");
57+
}
58+
}
5259
```
5360

5461
### **...**

‎solution/0500-0599/0551.Student Attendance Record I/README_EN.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,20 @@ A student could be rewarded if his attendance record doesn't contain <b>more tha
5757
### **Python3**
5858

5959
```python
60-
60+
class Solution:
61+
def checkRecord(self, s: str) -> bool:
62+
return s.count('A') <= 1 and 'LLL' not in s
6163
```
6264

6365
### **Java**
6466

6567
```java
66-
68+
class Solution {
69+
public boolean checkRecord(String s) {
70+
int i = s.indexOf("A");
71+
return (i == -1 || s.lastIndexOf("A") == i) && !s.contains("LLL");
72+
}
73+
}
6774
```
6875

6976
### **...**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution {
2+
public boolean checkRecord(String s) {
3+
int i = s.indexOf("A");
4+
return (i == -1 || s.lastIndexOf("A") == i) && !s.contains("LLL");
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def checkRecord(self, s: str) -> bool:
3+
return s.count('A') <= 1 and 'LLL' not in s

0 commit comments

Comments
 (0)