Min operations to convert A to B by incrementing A in the given range
Improve Article
Save Article
Like Article
Improve Article
Save Article
Given two integers A and B and a range defined by two integers C and D, the task is to convert A to B using the minimum number of operations possible. The only allowed operations are to add or subtract any integer greater than or equal to E to A. However, after each operation, the resulting value of A must lie in the range C to D (inclusive). If it is not possible to obtain B from A using these operations, return -1.Examples:Input: A = 4, B = 5, C…