Formatted question description: https://leetcode.ca/all/500.html
500. Keyboard Row
Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below.
Input: [“Hello”, “Alaska”, “Dad”, “Peace”]
Output: [“Alaska”, “Dad”]
- You may use one character in the keyboard more than once.
- You may assume the input string will only contain letters of alphabet.
For each letter, store its row. Then check each word to see whether the letters are in the same row. If so, add the word to the result array.