1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 03:11:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

批量更新数据

This commit is contained in:
2025-01-09 20:29:41 +08:00
parent 04ecea043d
commit 48cdd06c2b
5053 changed files with 156164 additions and 135322 deletions

View File

@@ -1,30 +1,29 @@
<p>给定一个整数,编写一个算法将这个数转换为十六进制数。对于负整数,我们通常使用&nbsp;<a href="https://baike.baidu.com/item/%E8%A1%A5%E7%A0%81/6854613?fr=aladdin">补码运算</a>&nbsp;方法。</p>
<p><strong>注意:</strong></p>
<p>答案字符串中的所有字母都应该是小写字符,并且除了 0 本身之外,答案中不应该有任何前置零。</p>
<ol>
<li>十六进制中所有字母(<code>a-f</code>)都必须是小写。</li>
<li>十六进制字符串中不能包含多余的前导零。如果要转化的数为0那么以单个字符<code>&#39;0&#39;</code>来表示对于其他情况十六进制字符串中的第一个字符将不会是0字符。&nbsp;</li>
<li>给定的数确保在32位有符号整数范围内。</li>
<li><strong>不能使用任何由库提供的将数字直接转换或格式化为十六进制的方法。</strong></li>
</ol>
<p><strong>注意: </strong>不允许使用任何由库提供的将数字直接转换或格式化为十六进制的方法来解决这个问题。</p>
<p><strong>示例 1</strong></p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<pre>
输入:
26
输出:
&quot;1a&quot;
<b>输入:</b>num = 26
<b>输出:</b>"1a"
</pre>
<p><strong>示例 2</strong></p>
<p><strong class="example">示例 2</strong></p>
<pre>
输入:
-1
输出:
&quot;ffffffff&quot;
<b>输入:</b>num = -1
<b>输出:</b>"ffffffff"
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>-2<sup>31</sup> &lt;= num &lt;= 2<sup>31</sup> - 1</code></li>
</ul>