mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-11 10:21:43 +08:00
批量更新数据
This commit is contained in:
@@ -1,55 +1,52 @@
|
||||
<p>A <strong>valid number</strong> can be split up into these components (in order):</p>
|
||||
<p>Given a string <code>s</code>, return whether <code>s</code> is a <strong>valid number</strong>.<br />
|
||||
<br />
|
||||
For example, all the following are valid numbers: <code>"2", "0089", "-0.1", "+3.14", "4.", "-.9", "2e10", "-90E3", "3e+7", "+6e-1", "53.5e93", "-123.456e789"</code>, while the following are not valid numbers: <code>"abc", "1a", "1e", "e3", "99e2.5", "--6", "-+3", "95a54e53"</code>.</p>
|
||||
|
||||
<p>Formally, a <strong>valid number</strong> is defined using one of the following definitions:</p>
|
||||
|
||||
<ol>
|
||||
<li>A <strong>decimal number</strong> or an <strong>integer</strong>.</li>
|
||||
<li>(Optional) An <code>'e'</code> or <code>'E'</code>, followed by an <strong>integer</strong>.</li>
|
||||
<li>An <strong>integer number</strong> followed by an <strong>optional exponent</strong>.</li>
|
||||
<li>A <strong>decimal number</strong> followed by an <strong>optional exponent</strong>.</li>
|
||||
</ol>
|
||||
|
||||
<p>A <strong>decimal number</strong> can be split up into these components (in order):</p>
|
||||
<p>An <strong>integer number</strong> is defined with an <strong>optional sign</strong> <code>'-'</code> or <code>'+'</code> followed by <strong>digits</strong>.</p>
|
||||
|
||||
<p>A <strong>decimal number</strong> is defined with an <strong>optional sign</strong> <code>'-'</code> or <code>'+'</code> followed by one of the following definitions:</p>
|
||||
|
||||
<ol>
|
||||
<li>(Optional) A sign character (either <code>'+'</code> or <code>'-'</code>).</li>
|
||||
<li>One of the following formats:
|
||||
<ol>
|
||||
<li>One or more digits, followed by a dot <code>'.'</code>.</li>
|
||||
<li>One or more digits, followed by a dot <code>'.'</code>, followed by one or more digits.</li>
|
||||
<li>A dot <code>'.'</code>, followed by one or more digits.</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li><strong>Digits</strong> followed by a <strong>dot</strong> <code>'.'</code>.</li>
|
||||
<li><strong>Digits</strong> followed by a <strong>dot</strong> <code>'.'</code> followed by <strong>digits</strong>.</li>
|
||||
<li>A <strong>dot</strong> <code>'.'</code> followed by <strong>digits</strong>.</li>
|
||||
</ol>
|
||||
|
||||
<p>An <strong>integer</strong> can be split up into these components (in order):</p>
|
||||
<p>An <strong>exponent</strong> is defined with an <strong>exponent notation</strong> <code>'e'</code> or <code>'E'</code> followed by an <strong>integer number</strong>.</p>
|
||||
|
||||
<ol>
|
||||
<li>(Optional) A sign character (either <code>'+'</code> or <code>'-'</code>).</li>
|
||||
<li>One or more digits.</li>
|
||||
</ol>
|
||||
|
||||
<p>For example, all the following are valid numbers: <code>["2", "0089", "-0.1", "+3.14", "4.", "-.9", "2e10", "-90E3", "3e+7", "+6e-1", "53.5e93", "-123.456e789"]</code>, while the following are not valid numbers: <code>["abc", "1a", "1e", "e3", "99e2.5", "--6", "-+3", "95a54e53"]</code>.</p>
|
||||
|
||||
<p>Given a string <code>s</code>, return <code>true</code><em> if </em><code>s</code><em> is a <strong>valid number</strong></em>.</p>
|
||||
<p>The <strong>digits</strong> are defined as one or more digits.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "0"
|
||||
<strong>Output:</strong> true
|
||||
</pre>
|
||||
<div class="example-block">
|
||||
<p><strong>Input:</strong> <span class="example-io">s = "0"</span></p>
|
||||
|
||||
<p><strong>Output:</strong> <span class="example-io">true</span></p>
|
||||
</div>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "e"
|
||||
<strong>Output:</strong> false
|
||||
</pre>
|
||||
<div class="example-block">
|
||||
<p><strong>Input:</strong> <span class="example-io">s = "e"</span></p>
|
||||
|
||||
<p><strong>Output:</strong> <span class="example-io">false</span></p>
|
||||
</div>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "."
|
||||
<strong>Output:</strong> false
|
||||
</pre>
|
||||
<div class="example-block">
|
||||
<p><strong>Input:</strong> <span class="example-io">s = "."</span></p>
|
||||
|
||||
<p><strong>Output:</strong> <span class="example-io">false</span></p>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
Reference in New Issue
Block a user