Given two integers L and R, the task is to find the minimum possible value of (i * j) % 2019 where L ≤ i < j ≤ R
Input: L = 2020, R = 2040
(2020*2021)%2019 = 2
Input: L = 3, R = 4
- If R – L ≥ 2019 then answer is 0 as we will get a number in the range which is divisible by 2019 which gives remainder 0.
- If R – L < 2019 then we can run nested loops and find the minimum value.
Below is the implementation of the above approach:
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Remove minimum numbers from the array to get minimum OR value
- Minimum possible value of max(A, B) such that LCM(A, B) = C
- Find minimum x such that (x % k) * (x / k) == n
- Minimum value of N such that xor from 1 to N is equal to K
- Find minimum x such that (x % k) * (x / k) == n | Set-2
- Transform N to Minimum possible value
- Find the value of N when F(N) = f(a)+f(b) where a+b is the minimum possible and a*b = N
- Minimum LCM and GCD possible among all possible sub-arrays
- Minimum possible sum of array B such that AiBi = AjBj for all 1 ≤ i < j ≤ N
- Minimum value possible of a given function from the given set
- Minimum value to be added to X such that it is at least Y percent of N
- Sum of minimum elements of all subarrays
- Remove one element to get minimum OR value
- Minimum step to reach one
- Minimum number of bombs
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.