Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution {
- public int MaxArea(int[] height) {
- int head=0;
- int tail=height.Length-1;
- var max = 0;
- while(head<tail){
- max = Math.Max((tail-head) * Math.Min(height[head],height[tail]),max);
- if(height[head] < height[tail])
- head++;
- else
- tail--;
- }
- return max;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement