NeetCode #935LC-2523MediumMath & Geometry
← Back to All Problems

#935 · #2523 · Closest Prime Numbers in Range(范围内最接近的两个质数)

📌 Problem Statement & Constraints

Given two integers left and right, find two primes p1 < p2 in [left, right] with the smallest difference. Return [p1, p2], or [-1, -1] if fewer than two primes exist. Constraints: 1 <= left <= right <= 10^6.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!