Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given n non - negative integers a 1 , a 2 , . . . , an , where each represents a point at coordinate
Given n nonnegative integers a a an where each represents a point at coordinate i ai n vertical
lines are drawn such that the two endpoints of line i is at i ai and i Find two lines, which together
with xaxis forms a container, such that the container contains the most water. Here are some examples:
Example :
Input: array
Output:
Explanation : and are distance apart. So the size of the base Height of container
min So total area
Example :
Input: array
Output:
Explanation : and are distance apart. So the size of the base Height of container
min So total area
Solve the problem with bruteforce approach by providing the pseudocode for this problem. What is
the time complexity of this approach?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started