552. Student Attendance Record II
https://leetcode.com/problems/redundant-connection-ii/description/
Last updated
Was this helpful?
https://leetcode.com/problems/redundant-connection-ii/description/
Last updated
Was this helpful?
由L、A、P组成的长度为n的字符串,不能出现连续3个或以上的L,最多出现一个A,有多少个这样的字符串。这里直接引用的解法:
很明显需要n步决策,每次决策时候要从3个字母里面选合法的,P任何情况都合法,A在没出现过的情况下合法,L则在现有串最后不是AA时候合法,因此状态就是是否出现过A和最后两个字母中L的分布情况的一个组合,A是否出现有两个值,L的分布有**,*L,LL三种(*代表A或P,不用展开了),所以就是2*3=6种状态啦