Leetcode 3589. Count Prime-Gap Balanced Subarrays
Count the contiguous subarrays that contain at least two prime numbers and whose maximum prime minus minimum prime is ≤ k; with n up to 5×10^4 this is best solved by efficient prime detection plus a sliding-window/two-pointer scan over prime positions to count valid intervals.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.