“`” 参考回答:

把每个数放到自己对应序号的位置上,如果其他位置上有和自己对应序号相同的数,那么即为有重复的数值。时间复杂度为O(N),同时为了节省空间复杂度,可以在原数组上进行操作,空间复杂度为O(1)

<pre><code>
</code></pre>

<pre><code> "“`

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.