Class Solution

java.lang.Object
g0401_0500.s0500_keyboard_row.Solution

public class Solution extends Object
500 - Keyboard Row.<p>Easy</p> <p>Given an array of strings <code>words</code>, return <em>the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below</em>.</p> <p>In the <strong>American keyboard</strong>:</p> <ul> <li>the first row consists of the characters <code>&quot;qwertyuiop&quot;</code>,</li> <li>the second row consists of the characters <code>&quot;asdfghjkl&quot;</code>, and</li> <li>the third row consists of the characters <code>&quot;zxcvbnm&quot;</code>.</li> </ul> <p><img src="https://assets.leetcode.com/uploads/2018/10/12/keyboard.png" alt="" /></p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> words = [&ldquo;Hello&rdquo;,&ldquo;Alaska&rdquo;,&ldquo;Dad&rdquo;,&ldquo;Peace&rdquo;]</p> <p><strong>Output:</strong> [&ldquo;Alaska&rdquo;,&ldquo;Dad&rdquo;]</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> words = [&ldquo;omk&rdquo;]</p> <p><strong>Output:</strong> []</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> words = [&ldquo;adsdf&rdquo;,&ldquo;sfd&rdquo;]</p> <p><strong>Output:</strong> [&ldquo;adsdf&rdquo;,&ldquo;sfd&rdquo;]</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= words.length <= 20</code></li> <li><code>1 <= words[i].length <= 100</code></li> <li><code>words[i]</code> consists of English letters (both lowercase and uppercase).</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details