mirror of
				https://gitee.com/coder-xiaomo/leetcode-problemset
				synced 2025-11-04 19:53:12 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<p>一个由字母和数字组成的字符串的 <strong>值</strong> 定义如下:</p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li>如果字符串 <strong>只</strong> 包含数字,那么值为该字符串在 <code>10</code> 进制下的所表示的数字。</li>
 | 
						||
	<li>否则,值为字符串的 <strong>长度 </strong>。</li>
 | 
						||
</ul>
 | 
						||
 | 
						||
<p>给你一个字符串数组 <code>strs</code> ,每个字符串都只由字母和数字组成,请你返回 <code>strs</code> 中字符串的 <strong>最大值</strong> 。</p>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>示例 1:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<strong>输入:</strong>strs = ["alic3","bob","3","4","00000"]
 | 
						||
<b>输出:</b>5
 | 
						||
<b>解释:</b>
 | 
						||
- "alic3" 包含字母和数字,所以值为长度 5 。
 | 
						||
- "bob" 只包含字母,所以值为长度 3 。
 | 
						||
- "3" 只包含数字,所以值为 3 。
 | 
						||
- "4" 只包含数字,所以值为 4 。
 | 
						||
- "00000" 只包含数字,所以值为 0 。
 | 
						||
所以最大的值为 5 ,是字符串 "alic3" 的值。
 | 
						||
</pre>
 | 
						||
 | 
						||
<p><strong>示例 2:</strong></p>
 | 
						||
 | 
						||
<pre>
 | 
						||
<b>输入:</b>strs = ["1","01","001","0001"]
 | 
						||
<b>输出:</b>1
 | 
						||
<b>解释:</b>
 | 
						||
数组中所有字符串的值都是 1 ,所以我们返回 1 。</pre>
 | 
						||
 | 
						||
<p> </p>
 | 
						||
 | 
						||
<p><strong>提示:</strong></p>
 | 
						||
 | 
						||
<ul>
 | 
						||
	<li><code>1 <= strs.length <= 100</code></li>
 | 
						||
	<li><code>1 <= strs[i].length <= 9</code></li>
 | 
						||
	<li><code>strs[i]</code> 只包含小写英文字母和数字。</li>
 | 
						||
</ul>
 |