Skip to content

Instantly share code, notes, and snippets.

@luojiyin1987
Created August 30, 2017 15:07
Show Gist options
  • Save luojiyin1987/20a20a747a56f36ff636ad858b662c30 to your computer and use it in GitHub Desktop.
Save luojiyin1987/20a20a747a56f36ff636ad858b662c30 to your computer and use it in GitHub Desktop.
Student Attendance Record I
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