Need a clear description with a few simple cases

  • 5


    I am not able to understand the non-trivial nature of the question.
    Can we not not always obtain largest area by choosing the first and the last as the two lines? I am sure this might not be the case as it would be too trivial. Help me with some counter argument.

    Thanks in advance

  • 16

    That's because when calculate the rectangle area we need to do a*b , a can be biggest by choosing the first and the last as the two lines , but we still need to take b value into consideration.

    take this as an example
    [ 1,5,1,1,1,5] the corresponding x-coordinate would be [0,1,2,3,4,5]

    so if we chose the first and the last two line.Since 1<5 we have to choose 1 as b value.So the area is 5.
    But it is obviously when we choose the second and the last line we would get the biggest value. 5*4=20.

    I hope this would be help :)

  • 0

    great, after reading this article, i fully understand what this problem wants us to do here.thanks;)

  • 0

    Thanks for the clarification! Now I understand what "can't slant" means!

Log in to reply

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