<p>Given an integer <code>num</code>, find the closest two integers in absolute difference whose product equals&nbsp;<code>num + 1</code>&nbsp;or <code>num + 2</code>.</p>

<p>Return the two integers in any order.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> num = 8
<strong>Output:</strong> [3,3]
<strong>Explanation:</strong> For num + 1 = 9, the closest divisors are 3 &amp; 3, for num + 2 = 10, the closest divisors are 2 &amp; 5, hence 3 &amp; 3 is chosen.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> num = 123
<strong>Output:</strong> [5,25]
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> num = 999
<strong>Output:</strong> [40,25]
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= num &lt;= 10^9</code></li>
</ul>

class Solution:
    def closestDivisors(self, num: int) -> List[int]:
    
#         def find_for_num(val):
#             one = int(math.sqrt(val))
#             two = one
            
#             while True:
#                 curr= one*two
#                 if curr == val:
#                     return [one,two]
#                 if curr > val:
#                     one -= 1
#                 else:
#                     two += 1
#         pair_1 = find_for_num(num+1)
#         pair_2 = find_for_num(num+2)
#         diff_1 = pair_1[1] - pair_1[0]
#         diff_2 = pair_2[1] - pair_2[0]
        
#         if diff_1 < diff_2:
#             return pair_1
#         else:
#             return pair_2

        def get_factors(number):
            factors = []
            for i in range(1, int(number ** 0.5) + 1):
                if number % i == 0:
                    factors.append(i)
                    if i != number // i:
                        factors.append(number // i)
            factors.sort()
            if len(factors) % 2 == 0:
                return [factors[len(factors)//2-1],factors[len(factors)//2]]
            else:
                return [factors[len(factors)//2],factors[len(factors)//2]]
        fact_1 = get_factors(num+1)
        fact_2 = get_factors(num+2)
        diff_1 = fact_1[1]- fact_1[0]
        diff_2 = fact_2[1]- fact_2[0]
        if diff_1 < diff_2:
            return fact_1
        else:
            return fact_2
        
        # 785270913
            
        
153