Given an integer C, the task is to find the minimum possible value of max(A, B) such that LCM(A, B) = C.
Input: C = 6
max(1, 6) = 6
max(2, 3) = 3
and min(6, 3) = 3
Input: C = 9
Approach: An approach to solve this problem is to find all the factors of the given number using the approach discussed in this article and then find the pair (A, B) that satisfies the given conditions and take the overall minimum of the maximum of these pairs.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Minimum possible value T such that at most D Partitions of the Array having at most sum T is possible
- Find the maximum possible value of the minimum value of modified array
- Minimum LCM and GCD possible among all possible sub-arrays
- Possible values of Q such that, for any value of R, their product is equal to X times their sum
- Find the largest possible value of K such that K modulo X is Y
- Minimum positive integer value possible of X for given A and B in X = P*A + Q*B
- Minimum value possible of a given function from the given set
- Find the value of N when F(N) = f(a)+f(b) where a+b is the minimum possible and a*b = N
- Minimum possible value of (i * j) % 2019
- Transform N to Minimum possible value
- Partitions possible such that the minimum element divides all the other elements of the partition
- Minimum possible sum of array B such that AiBi = AjBj for all 1 ≤ i < j ≤ N
- Count possible splits of sum N into K integers such that the minimum is at least P
- Minimum value of N such that xor from 1 to N is equal to K
- Minimum value to be added to X such that it is at least Y percent of N
- Minimum value of K such that sum of cubes of first K natural number is greater than equal to N
- Remove minimum numbers from the array to get minimum OR value
- Find the maximum possible value of a[i] % a[j] over all pairs of i and j
- Find the maximum possible value for the given periodic function
- Possible pairs forming a Pythagorean Triple with a given value
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.