1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-09 09:21:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
Files
leetcode-problemset/leetcode-cn/problem (Chinese)/平方数组的数目 [number-of-squareful-arrays].html
2025-01-09 20:29:41 +08:00

32 lines
994 B
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>如果一个数组的任意两个相邻元素之和都是 <strong>完全平方数 </strong>,则该数组称为 <strong>平方数组 </strong></p>
<p>给定一个整数数组 <code>nums</code>,返回所有属于 <strong>平方数组 </strong><code>nums</code> 的排列数量。</p>
<p>如果存在某个索引 <code>i</code> 使得 <code>perm1[i] != perm2[i]</code>,则认为两个排列 <code>perm1</code><code>perm2</code> 不同。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = [1,17,8]
<strong>输出:</strong>2
<strong>解释:</strong>[1,8,17] 和 [17,8,1] 是有效的排列。
</pre>
<p><strong class="example">示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = [2,2,2]
<strong>输出:</strong>1
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 12</code></li>
<li><code>0 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
</ul>