Company: Axis Bank
Difficulty: medium
Output Format Print Q space-separated integers representing the answer. Constraints 1 ≤ Q ≤ 10 5 1 ≤ L ≤ R ≤ 10 6 Examples Sample Input 2 1 2 2 4 Sample Output 3 5 Explanation Given Q=2 Queries = [[1, 2], [2, 4]] Approach For query 1, [1, 2] -> [4, 0] -> [1, 0] -> [0, 0], Minimum operation = 3 For query 2, [2, 3, 4] -> [2, 0, 16] -> [0, 0, 16] -> [0, 0, 4] -> [0, 0, 1] -> [0, 0, 0], Minimum operation = 5 .problem-container { max-width: 800px; margin: 0 auto; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif; } code { background-color: #f5f5f5; padding: 2px 4px; border-radius: 4px; font-family: Consolas, Monaco, \'Courier New\', monospace; } pre { background-color: #f8f9fa; padding: 15px; border-radius: 4px; overflow-x: auto; margin: 10px 0; } .example { margin: 20px 0; padding: 15px; border: 1px solid #eee; border-radius: 4px; } .explanation { margin-top: 20px; padding: 15px; background-color: #f8f9fa; border-left