java.lang.Object
g0101_0200.s0171_excel_sheet_column_number.Solution

public class Solution extends Object
171 - Excel Sheet Column Number.<p>Easy</p> <p>Given a string <code>columnTitle</code> that represents the column title as appear in an Excel sheet, return <em>its corresponding column number</em>.</p> <p>For example:</p> <pre><code> A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 ... </code></pre> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> columnTitle = &ldquo;A&rdquo;</p> <p><strong>Output:</strong> 1</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> columnTitle = &ldquo;AB&rdquo;</p> <p><strong>Output:</strong> 28</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> columnTitle = &ldquo;ZY&rdquo;</p> <p><strong>Output:</strong> 701</p> <p><strong>Example 4:</strong></p> <p><strong>Input:</strong> columnTitle = &ldquo;FXSHRXW&rdquo;</p> <p><strong>Output:</strong> 2147483647</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= columnTitle.length <= 7</code></li> <li><code>columnTitle</code> consists only of uppercase English letters.</li> <li><code>columnTitle</code> is in the range <code>[&quot;A&quot;, &quot;FXSHRXW&quot;]</code>.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • titleToNumber

      public int titleToNumber(String s)