Skip to content

Commit 0e0b0b6

Browse files
committed
Create README - LeetHub
1 parent 1886183 commit 0e0b0b6

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<h2><a href="https://leetcode.com/problems/complete-prime-number">4100. Complete Prime Number</a></h2><h3>Medium</h3><hr><p>You are given an integer <code>num</code>.</p>
2+
3+
<p>A number <code>num</code> is called a <strong>Complete Prime Number</strong> if every <strong>prefix</strong> and every <strong>suffix</strong> of <code>num</code> is <strong>prime</strong>.</p>
4+
5+
<p>Return <code>true</code> if <code>num</code> is a Complete Prime Number, otherwise return <code>false</code>.</p>
6+
7+
<p><strong>Note</strong>:</p>
8+
9+
<ul>
10+
<li>A <strong>prefix</strong> of a number is formed by the <strong>first</strong> <code>k</code> digits of the number.</li>
11+
<li>A <strong>suffix</strong> of a number is formed by the <strong>last</strong> <code>k</code> digits of the number.</li>
12+
<li>A <strong>prime</strong> number is a natural number greater than 1 with only two factors, 1 and itself.</li>
13+
<li>Single-digit numbers are considered Complete Prime Numbers only if they are <strong>prime</strong>.</li>
14+
</ul>
15+
16+
<p>&nbsp;</p>
17+
<p><strong class="example">Example 1:</strong></p>
18+
19+
<div class="example-block">
20+
<p><strong>Input:</strong> <span class="example-io">num = 23</span></p>
21+
22+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
23+
24+
<p><strong>Explanation:</strong></p>
25+
26+
<ul>
27+
<li><strong>​​​​​​​</strong>Prefixes of <code>num = 23</code> are 2 and 23, both are prime.</li>
28+
<li>Suffixes of <code>num = 23</code> are 3 and 23, both are prime.</li>
29+
<li>All prefixes and suffixes are prime, so 23 is a Complete Prime Number and the answer is <code>true</code>.</li>
30+
</ul>
31+
</div>
32+
33+
<p><strong class="example">Example 2:</strong></p>
34+
35+
<div class="example-block">
36+
<p><strong>Input:</strong> <span class="example-io">num = 39</span></p>
37+
38+
<p><strong>Output:</strong> <span class="example-io">false</span></p>
39+
40+
<p><strong>Explanation:</strong></p>
41+
42+
<ul>
43+
<li>Prefixes of <code>num = 39</code> are 3 and 39. 3 is prime, but 39 is not prime.</li>
44+
<li>Suffixes of <code>num = 39</code> are 9 and 39. Both 9 and 39 are not prime.</li>
45+
<li>At least one prefix or suffix is not prime, so 39 is not a Complete Prime Number and the answer is <code>false</code>.</li>
46+
</ul>
47+
</div>
48+
49+
<p><strong class="example">Example 3:</strong></p>
50+
51+
<div class="example-block">
52+
<p><strong>Input:</strong> <span class="example-io">num = 7</span></p>
53+
54+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
55+
56+
<p><strong>Explanation:</strong></p>
57+
58+
<ul>
59+
<li>7 is prime, so all its prefixes and suffixes are prime and the answer is <code>true</code>.</li>
60+
</ul>
61+
</div>
62+
63+
<p>&nbsp;</p>
64+
<p><strong>Constraints:</strong></p>
65+
66+
<ul>
67+
<li><code>1 &lt;= num &lt;= 10<sup>9</sup></code></li>
68+
</ul>

0 commit comments

Comments
 (0)