Java very simple solution.


  • 0
    V
    class Solution {
        public boolean checkRecord(String s) 
        {
        		if (s.contains("LLL")) return false;
        		
        		String str = s.replaceAll("A", "");
        		
        		if ((s.length() - str.length()) > 1)
        		{
        			return false;
        		}
        		
        		
            return true;
            
        }
    }
    
    

Log in to reply
 

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