`{"id":"ee0e98e6-ccf5-4bcb-b449-b2e0e02d20cd","name":"Finding Mino","description":"You have been given a Unimodal function:\r\n f(x) = 2x^2 - 12x + 7\r\nwith N intervals. For each interval, you will be given two integer values l and r, where and you need to find the minimum value of f(x) where x will be in the range [l, r] (both inclusive).","inputFormat":"The first line will consist of one integer N denoting the number of intervals.\r\nIn the next N lines, each line contains 2 space-separated integers, l, and r denoting the range of interval.","outputFormat":"Print N lines, where ith line denotes the minimum value of f(x), where x will be in the range [li, ri];","constraints":"1 &lt;= N &lt;= 10^5\r\n-10^6 &lt;= l &lt;= r &lt;= 10^6","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main {\r\n public static void findMin(double start, double end) {\r\n //Code Here\r\n\r\n }\r\n\r\n //===========================================//\r\n\r\n public static void main(String[] args) throws Exception\r\n {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n int testCase = Integer.parseInt(br.readLine());\r\n\r\n while (testCase-- > 0) {\r\n String input = br.readLine();\r\n String parts[] = input.split(\" \");\r\n\r\n double l = Double.parseDouble(parts[0]);\r\n double r = Double.parseDouble(parts[1]);\r\n\r\n findMin(l, r); //Function call\r\n }\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"1\r\n6 8","sampleOutput":"7","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"ccdbbb91-d392-43f3-8065-0ecd4a077535","name":"Ternary Search For Experts","slug":"ternary-search-for-experts-998","type":0},{"id":"fa9e6a05-a9a3-4337-bf90-ae28f5ad6ae8","name":"Finding Mino","slug":"finding-mino","type":1}],"next":{"id":"404e8d8d-6a24-42bf-8b8f-f673eed4c599","name":"Is This Jee","type":1,"slug":"is-this-jee"},"prev":{"id":"86633a85-3aac-464d-abc2-414f046cfbf2","name":"Searching An Element In A Sorted Array","type":1,"slug":"searching-an-element-in-a-sorted-array"}}}`

# Finding Mino

You have been given a Unimodal function: f(x) = 2x^2 - 12x + 7 with N intervals. For each interval, you will be given two integer values l and r, where and you need to find the minimum value of f(x) where x will be in the range [l, r] (both inclusive).

`{"id":"ee0e98e6-ccf5-4bcb-b449-b2e0e02d20cd","name":"Finding Mino","description":"You have been given a Unimodal function:\r\n f(x) = 2x^2 - 12x + 7\r\nwith N intervals. For each interval, you will be given two integer values l and r, where and you need to find the minimum value of f(x) where x will be in the range [l, r] (both inclusive).","inputFormat":"The first line will consist of one integer N denoting the number of intervals.\r\nIn the next N lines, each line contains 2 space-separated integers, l, and r denoting the range of interval.","outputFormat":"Print N lines, where ith line denotes the minimum value of f(x), where x will be in the range [li, ri];","constraints":"1 &lt;= N &lt;= 10^5\r\n-10^6 &lt;= l &lt;= r &lt;= 10^6","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.*;\r\nimport java.io.*;\r\n\r\npublic class Main {\r\n public static void findMin(double start, double end) {\r\n //Code Here\r\n\r\n }\r\n\r\n //===========================================//\r\n\r\n public static void main(String[] args) throws Exception\r\n {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n int testCase = Integer.parseInt(br.readLine());\r\n\r\n while (testCase-- > 0) {\r\n String input = br.readLine();\r\n String parts[] = input.split(\" \");\r\n\r\n double l = Double.parseDouble(parts[0]);\r\n double r = Double.parseDouble(parts[1]);\r\n\r\n findMin(l, r); //Function call\r\n }\r\n }\r\n}\r\n"},"ruby":{"code":""},"python":{"code":""},"javascript":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"1\r\n6 8","sampleOutput":"7","questionVideo":"","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"ccdbbb91-d392-43f3-8065-0ecd4a077535","name":"Ternary Search For Experts","slug":"ternary-search-for-experts-998","type":0},{"id":"fa9e6a05-a9a3-4337-bf90-ae28f5ad6ae8","name":"Finding Mino","slug":"finding-mino","type":1}],"next":{"id":"404e8d8d-6a24-42bf-8b8f-f673eed4c599","name":"Is This Jee","type":1,"slug":"is-this-jee"},"prev":{"id":"86633a85-3aac-464d-abc2-414f046cfbf2","name":"Searching An Element In A Sorted Array","type":1,"slug":"searching-an-element-in-a-sorted-array"}}}`

Editor

# Finding Mino

easy

You have been given a Unimodal function: f(x) = 2x^2 - 12x + 7 with N intervals. For each interval, you will be given two integer values l and r, where and you need to find the minimum value of f(x) where x will be in the range [l, r] (both inclusive).

## Constraints

1 <= N <= 10^5 -10^6 <= l <= r <= 10^6

## Format

### Input

The first line will consist of one integer N denoting the number of intervals. In the next N lines, each line contains 2 space-separated integers, l, and r denoting the range of interval.

### Output

Print N lines, where ith line denotes the minimum value of f(x), where x will be in the range [li, ri];

## Example

Sample Input

```.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}1 6 8```

### Sample Output

`.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}7`

Discussions

Show Discussion

Related Resources