# Why is this solution wrong ?

• I have submitted this solution and it shows the wrong result for following test case.

Input:
[2,3,4,5,18,17,6]
Output:
16
Expected:
17

I don't understand how could the expected value be 17 in this scenario.

'''
class Solution(object):

def maxArea(self, height):

``````    start = 0
end   = len(height) - 1;

small = min(height[start], height[end])
mArea = small * (end - start)

while start < end:

while height[start] <= small and start < end:
start += 1

while height[end] <= small and start < end:
end =- 1

if start < end:
small = min(height[start], height[end])
area = small * (end - start)
#print "A =",area," s=",start,":",height[start]," e=",end,":",height[end]

if area > mArea:
mArea = area

return mArea
``````

'''

• Input:
[2,3,4,5,18,17,6]
Output:
16
Expected:
17

So the algorithm should be to compute the max area out of:
26=12
3
5=15
44=16
5
3=15
62=12
17
1=17

Does it make sense?

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.