Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. public class Solution {
  2. public int MaxArea(int[] height) {
  3.  
  4. int head=0;
  5. int tail=height.Length-1;
  6. var max = 0;
  7.  
  8. while(head<tail){
  9. max = Math.Max((tail-head) * Math.Min(height[head],height[tail]),max);
  10.  
  11. if(height[head] < height[tail])
  12. head++;
  13. else
  14. tail--;
  15. }
  16. return max;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement