Created
August 30, 2017 15:07
-
-
Save luojiyin1987/20a20a747a56f36ff636ad858b662c30 to your computer and use it in GitHub Desktop.
Student Attendance Record I
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func checkRecord(s string) bool { | |
| countA := 0 | |
| countL := 0 | |
| for _, k := range s{ | |
| if k == 65 { | |
| countA ++ | |
| } | |
| if k == 76 { | |
| countL++ | |
| } else { | |
| countL= 0 | |
| } | |
| if countA>1 ||countL >2 { | |
| return false | |
| } | |
| } | |
| return true | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment