javascript solution


  • 0
    L

    first, you should to define a RegExperision;
    then, to filter the array;

    var findWords = function(words) {
        const reg = /([ASDFGHJKLasdfghjkl]+)|([QWERTYUIOPqwertyuiop]+)|([ZXCVBNMzxcvbnm]+)/;
        return words.filter(item => item === reg.exec(item)[0]);
    };
    

Log in to reply
 

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