500. Keyboard Row

啊呀窝草。。尼玛JAVA写的真是烦啊,还不如去写Python算了,人家五六行我得30行。

class Solution {
    public String[] findWords(String[] words) {
        ArrayList result = new ArrayList<>();
        HashSet set1 = new HashSet<>();
        HashSet set2 = new HashSet<>();
        HashSet set3 = new HashSet<>();
        intal_rows(set1,"QWERTYUIOPqwertyuiop");
        intal_rows(set2,"ASDFGHJKLasdfghjkl");
        intal_rows(set3,"ZXCVBNMzxcvbnm");
         Sub(set1,words,result);
         Sub(set2,words,result);
         Sub(set3,words,result);
         String[] s = new String[result.size()];
          result.toArray(s);
         return s;
    }
    private void intal_rows (HashSet set,String s)
    {
        for(int i =0;i set,String[] words,ArrayList result)
    {
        for(String s :words)
        {
            int i =0;
            for( i = 0 ;i

你可能感兴趣的:(500. Keyboard Row)