Easy Regex Python Solution


  • 0
    P
        s = expression[::-1]
    
        while ":" in s:
            s = re.sub('([\dTF]):([\dTF])\?([TF])', lambda m: m.group(2) if m.group(3) == "T" else m.group(1), s, 1)
        return s

Log in to reply
 

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