mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 11:43:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			46 lines
		
	
	
		
			976 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			976 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
<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>
 | 
						|
A -> 1
 | 
						|
B -> 2
 | 
						|
C -> 3
 | 
						|
...
 | 
						|
Z -> 26
 | 
						|
AA -> 27
 | 
						|
AB -> 28 
 | 
						|
...
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </p>
 | 
						|
<p><strong>Example 1:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> columnTitle = "A"
 | 
						|
<strong>Output:</strong> 1
 | 
						|
</pre>
 | 
						|
 | 
						|
<p><strong>Example 2:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> columnTitle = "AB"
 | 
						|
<strong>Output:</strong> 28
 | 
						|
</pre>
 | 
						|
 | 
						|
<p><strong>Example 3:</strong></p>
 | 
						|
 | 
						|
<pre>
 | 
						|
<strong>Input:</strong> columnTitle = "ZY"
 | 
						|
<strong>Output:</strong> 701
 | 
						|
</pre>
 | 
						|
 | 
						|
<p> </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>["A", "FXSHRXW"]</code>.</li>
 | 
						|
</ul>
 |