Python Solution without regex

  • 0
    class Solution(object):
        def checkRecord(self, s):
            :type s: str
            :rtype: bool
        	l = [x == "L" for x in s]
        	return not (s.count("A")>=2 or any(map(ll, l, l[1:], l[2:])))
    def ll(x, y, z):
    	return x and y and z

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.