_3115

package
v0.0.0-...-5ea41ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 1 Imported by: 0

README

质数的最大距离

给你一个整数数组 nums

返回两个(不一定不同的)质数在 nums 中 下标最大距离

示例 1:

**输入:**nums = [4,2,9,5,3]

**输出:**3

解释:nums[1]nums[3]nums[4] 是质数。因此答案是 |4 - 1| = 3

示例 2:

**输入:**nums = [4,8,2,8]

**输出:**0

解释:nums[2] 是质数。因为只有一个质数,所以答案是 |2 - 2| = 0

提示:

  • 1 <= nums.length <= 3 * 105
  • 1 <= nums[i] <= 100
  • 输入保证 nums 中至少有一个质数。

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL