Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dac8f31

Browse files
Student Attendance Record I
1 parent 975eeb7 commit dac8f31

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package leetcode2018;
2+
3+
public class StudentAttendanceRecordI {
4+
public boolean checkRecord(String s) {
5+
if(s.length() == 0) return true;
6+
int i=0;
7+
int j=0;
8+
9+
for(char c: s.toCharArray()){
10+
if(c!='L') j=0;
11+
if(c=='A') i++;
12+
if(c=='L') j++;
13+
if(j>2) return false;
14+
}
15+
if(i>1) return false;
16+
return true;
17+
}
18+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /