1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/正方形数组的数目 [number-of-squareful-arrays].html
2022-03-29 12:43:11 +08:00

29 lines
827 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>给定一个非负整数数组&nbsp;<code>A</code>,如果该数组每对相邻元素之和是一个完全平方数,则称这一数组为<em>正方形</em>数组。</p>
<p>返回 A 的正方形排列的数目。两个排列 <code>A1</code><code>A2</code> 不同的充要条件是存在某个索引 <code>i</code>,使得 A1[i] != A2[i]。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>[1,17,8]
<strong>输出:</strong>2
<strong>解释:</strong>
[1,8,17] 和 [17,8,1] 都是有效的排列。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>[2,2,2]
<strong>输出:</strong>1
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ol>
<li><code>1 &lt;= A.length &lt;= 12</code></li>
<li><code>0 &lt;= A[i] &lt;= 1e9</code></li>
</ol>