mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
53 lines
1.5 KiB
HTML
53 lines
1.5 KiB
HTML
<p>给你一个整数数组 <code>nums</code> 。</p>
|
||
|
||
<p>请你将 <code>nums</code> 中每一个元素都替换为它的各个数位之 <strong>和</strong> 。</p>
|
||
|
||
<p>请你返回替换所有元素以后 <code>nums</code> 中的 <strong>最小</strong> 元素。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong class="example">示例 1:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><span class="example-io"><b>输入:</b>nums = [10,12,13,14]</span></p>
|
||
|
||
<p><span class="example-io"><b>输出:</b>1</span></p>
|
||
|
||
<p><strong>解释:</strong></p>
|
||
|
||
<p><code>nums</code> 替换后变为 <code>[1, 3, 4, 5]</code> ,最小元素为 1 。</p>
|
||
</div>
|
||
|
||
<p><strong class="example">示例 2:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><span class="example-io"><b>输入:</b>nums = [1,2,3,4]</span></p>
|
||
|
||
<p><span class="example-io"><b>输出:</b>1</span></p>
|
||
|
||
<p><b>解释:</b></p>
|
||
|
||
<p><code>nums</code> 替换后变为 <code>[1, 2, 3, 4]</code> ,最小元素为 1 。</p>
|
||
</div>
|
||
|
||
<p><strong class="example">示例 3:</strong></p>
|
||
|
||
<div class="example-block">
|
||
<p><span class="example-io"><b>输入:</b>nums = [999,19,199]</span></p>
|
||
|
||
<p><span class="example-io"><b>输出:</b>10</span></p>
|
||
|
||
<p><strong>解释:</strong></p>
|
||
|
||
<p><code>nums</code> 替换后变为 <code>[27, 10, 19]</code> ,最小元素为 10 。</p>
|
||
</div>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= nums.length <= 100</code></li>
|
||
<li><code>1 <= nums[i] <= 10<sup>4</sup></code></li>
|
||
</ul>
|