Tap here to switch tabs
Problem
Submissions

Problem: Closest Divisors

Closest Divisors asks you to find a pair of positive integers whose product is either one or two greater than a given number, minimizing their absolute difference.

Statement

Given an integer num, find two integers whose product is equal to num +1+ 1 or num +2+ 2 such that the absolute difference between the two integers is minimized.

Return the two integers in any order.

Constraints:

  • 1≤1 \leq num ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Closest Divisors

Closest Divisors asks you to find a pair of positive integers whose product is either one or two greater than a given number, minimizing their absolute difference.

Statement

Given an integer num, find two integers whose product is equal to num +1+ 1 or num +2+ 2 such that the absolute difference between the two integers is minimized.

Return the two integers in any order.

Constraints:

  • 1≤1 \leq num ≤109\leq 10^9