Search
⌘K

Leetcode 1362. Closest Divisors

Given num, find two integers whose product equals either num+1 or num+2 and whose absolute difference is minimal, and return that factor pair. The typical approach is to search for divisors near the square root of num+1 and num+2 (num up to 1e9).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.