Been going crazy trying to figure out where I am wrong in my code. Maybe a new set of eyes could tell me
def checkRecord(n): """ :type n: int :rtype: int """ mod = 10 ** 9 + 7 a0l0=1 a0l1=a0l2=a1l0=a1l1=a1l2=0 for i in xrange(n): a010,a0l1,a0l2,a1l0,a1l1,a1l2=(a0l0+a0l1+a0l2)%mod,a0l0,a0l1,(a0l0+a0l1+a0l2+a1l0+a1l1+a1l2)%mod,a1l0,a1l1 print a010,a0l1,a0l2,a1l0,a1l1,a1l2 return sum((a010,a0l1,a0l2,a1l0,a1l1,a1l2))%mod checkRecord(3)
@livelearn I'm not seeing an array here. Is the theory that you are only keeping the last 3 columns of the traditional DP?
@Avidiax The theory is very similar to the editorial solution, I believe. Basically, you start with P and add the other letters. There's a diagram on there where you can see the state between moving from P to A to AL.
@livelearn NVM I'm an idiot, there's a 1 in there that looks like a L
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.