1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-12 10:51:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/检查元素频次是否为质数 [check-if-any-element-has-prime-frequency].html
2025-06-27 15:44:17 +08:00

55 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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>nums</code></p>
<p>如果数组中任一元素的&nbsp;<strong>频次&nbsp;</strong>&nbsp;<strong>质数</strong>,返回 <code>true</code>;否则,返回 <code>false</code></p>
<p>元素 <code>x</code>&nbsp;<strong>频次&nbsp;</strong>是它在数组中出现的次数。</p>
<p>质数是一个大于 1 的自然数并且只有两个因数1 和它本身。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">nums = [1,2,3,4,5,4]</span></p>
<p><strong>输出:</strong> <span class="example-io">true</span></p>
<p><strong>解释:</strong></p>
<p>数字 4 的频次是 2而 2 是质数。</p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">nums = [1,2,3,4,5]</span></p>
<p><strong>输出:</strong> <span class="example-io">false</span></p>
<p><strong>解释:</strong></p>
<p>所有元素的频次都是 1。</p>
</div>
<p><strong class="example">示例 3</strong></p>
<div class="example-block">
<p><strong>输入:</strong> <span class="example-io">nums = [2,2,2,4,4]</span></p>
<p><strong>输出:</strong> <span class="example-io">true</span></p>
<p><strong>解释:</strong></p>
<p>数字 2 和 4 的频次都是质数。</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 100</code></li>
<li><code>0 &lt;= nums[i] &lt;= 100</code></li>
</ul>