C# Regex solution - Accepted


  • 0
    N
    public class Solution {
        public bool CheckRecord(string s) {
            
        string pattern = @"(\w)*LLL+|(\w)*(A)+(\w)*(A)+(\w)*";
        
        Regex r = new Regex(pattern, RegexOptions.IgnoreCase);
        
        Match m = r.Match(s);
        
        if(m.Success) return false;
        else return true;
    
        }
    }
    

Log in to reply
 

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