Python solution (this is not a programming questions IMO)


  • 2
    A
    class Solution:
        def flipLights(self, n, m):
            """
            :type n: int
            :type m: int
            :rtype: int
            """
            if m == 0:
                return 1
            if n >= 3:
                return 4 if m == 1 else 7 if m == 2 else 8
            if n == 2:
                return 3 if m == 1 else 4
            if n == 1:
                return 2
    

Log in to reply
 

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