`{"id":"a146d9db-ee31-4820-baa5-17cdda2dbc14","name":"Container With Most Water","description":"1. You will be given coordinates as an array wherein, x,y is written as i,a[i]\r\n 2. So two endpoints of vertical line i is at (i, a[i]) and (i, 0)\r\n 3. You need to find two lines, which together along with x-axis forms a container, such that the container contains the most water\r\n 4. Input and output is handled for you\r\n 5. It is a functional problem ,please do not modify main()\r\n \r\n NOTE: a) a[i] value need not be distinct\r\n b) You can't slant a line","inputFormat":"Input is handled for you.","outputFormat":"Output is handled","constraints":"Array size is limited to integral range","sampleCode":{"cpp":{"code":"#include<iostream>\nusing namespace std;\n\nint main(){\n // write your code here\n return 0;\n}"},"java":{"code":"import java.util.*;\nimport java.io.*;\n\npublic class Main{\n public static void main(String args[]){\n // write your code here\n }\n}"},"python":{"code":"def main():\n print(\"Write your code here\")\n \nif __name__ == \"_main_\":\n main()"}},"points":10,"difficulty":"easy","sampleInput":"8\n2 10 6 5 8 7 1 3","sampleOutput":"28","questionVideo":null,"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":"35f2cfb0-6f25-4967-b0c9-92f2384b9260","name":"Arrays And Strings For Intermediate","slug":"arrays-and-strings-for-intermediate-732","type":0},{"id":"8a796e32-9bc2-4a8a-9178-5b75049cdcbc","name":"Container With Most Water","slug":"container-with-most-water","type":1}],"next":{"id":"31bf682b-7e6d-4739-8444-8cab56bd4fb3","name":"Container With Most Water","type":3,"slug":"container-with-most-water"},"prev":{"id":"8c117b7d-bd5a-4ada-a6db-7f37f76e101c","name":"Next Greater Element III MCQ","type":0,"slug":"next-greater-element-iii-mcq"}}}`

Container With Most Water

1. You will be given coordinates as an array wherein, x,y is written as i,a[i] 2. So two endpoints of vertical line i is at (i, a[i]) and (i, 0) 3. You need to find two lines, which together along with x-axis forms a container, such that the container contains the most water 4. Input and output is handled for you 5. It is a functional problem ,please do not modify main() NOTE: a) a[i] value need not be distinct b) You can't slant a line

`{"id":"a146d9db-ee31-4820-baa5-17cdda2dbc14","name":"Container With Most Water","description":"1. You will be given coordinates as an array wherein, x,y is written as i,a[i]\r\n 2. So two endpoints of vertical line i is at (i, a[i]) and (i, 0)\r\n 3. You need to find two lines, which together along with x-axis forms a container, such that the container contains the most water\r\n 4. Input and output is handled for you\r\n 5. It is a functional problem ,please do not modify main()\r\n \r\n NOTE: a) a[i] value need not be distinct\r\n b) You can't slant a line","inputFormat":"Input is handled for you.","outputFormat":"Output is handled","constraints":"Array size is limited to integral range","sampleCode":{"cpp":{"code":"#include<iostream>\nusing namespace std;\n\nint main(){\n // write your code here\n return 0;\n}"},"java":{"code":"import java.util.*;\nimport java.io.*;\n\npublic class Main{\n public static void main(String args[]){\n // write your code here\n }\n}"},"python":{"code":"def main():\n print(\"Write your code here\")\n \nif __name__ == \"_main_\":\n main()"}},"points":10,"difficulty":"easy","sampleInput":"8\n2 10 6 5 8 7 1 3","sampleOutput":"28","questionVideo":null,"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":"35f2cfb0-6f25-4967-b0c9-92f2384b9260","name":"Arrays And Strings For Intermediate","slug":"arrays-and-strings-for-intermediate-732","type":0},{"id":"8a796e32-9bc2-4a8a-9178-5b75049cdcbc","name":"Container With Most Water","slug":"container-with-most-water","type":1}],"next":{"id":"31bf682b-7e6d-4739-8444-8cab56bd4fb3","name":"Container With Most Water","type":3,"slug":"container-with-most-water"},"prev":{"id":"8c117b7d-bd5a-4ada-a6db-7f37f76e101c","name":"Next Greater Element III MCQ","type":0,"slug":"next-greater-element-iii-mcq"}}}`

Editor

Container With Most Water

easy

1. You will be given coordinates as an array wherein, x,y is written as i,a[i] 2. So two endpoints of vertical line i is at (i, a[i]) and (i, 0) 3. You need to find two lines, which together along with x-axis forms a container, such that the container contains the most water 4. Input and output is handled for you 5. It is a functional problem ,please do not modify main() NOTE: a) a[i] value need not be distinct b) You can't slant a line

Constraints

Array size is limited to integral range

Format

Input

Input is handled for you.

Output

Output is handled

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;}8 2 10 6 5 8 7 1 3```

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;}28`

Discussions

Show Discussion

Related Resources