C# Solution


  • 0
    S
    using System.Linq;
    using System.Collections.Generic;
    public class Solution {
        public string[] FindWords(string[] words) {
            string[] check = {"qwertyuiop","asdfghjkl","zxcvbnm"};
            List<string> result= new List<string>();
            foreach(string word in words)
            {
                for(int i=0;i<3;i++){
                    if(word.ToLower().All(m=>check[i].Contains(m)))
                    {
                        result.Add(word);
                        break;
                    }
                }
            }
            return result.ToArray();
        }
    }
    

Log in to reply
 

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