1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/替换隐藏数字得到的最晚时间 [latest-time-by-replacing-hidden-digits].html
2022-03-29 12:43:11 +08:00

39 lines
1.1 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个字符串 <code>time</code> ,格式为 <code> hh:mm</code>(小时:分钟),其中某几位数字被隐藏(用 <code>?</code> 表示)。</p>
<p>有效的时间为 <code>00:00</code><code>23:59</code> 之间的所有时间,包括 <code>00:00</code><code>23:59</code></p>
<p>替换 <code>time</code> 中隐藏的数字,返回你可以得到的最晚有效时间。</p>
<p> </p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>time = "2?:?0"
<strong>输出:</strong>"23:50"
<strong>解释:</strong>以数字 '2' 开头的最晚一小时是 23 ,以 '0' 结尾的最晚一分钟是 50 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>time = "0?:3?"
<strong>输出:</strong>"09:39"
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>time = "1?:22"
<strong>输出:</strong>"19:22"
</pre>
<p> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>time</code> 的格式为 <code>hh:mm</code></li>
<li>题目数据保证你可以由输入的字符串生成有效的时间</li>
</ul>