Skip to content

Instantly share code, notes, and snippets.

@dagenius007
Created February 24, 2024 08:32
Show Gist options
  • Save dagenius007/89a9a3954571b2c502d8493a7e6ea7c7 to your computer and use it in GitHub Desktop.
Save dagenius007/89a9a3954571b2c502d8493a7e6ea7c7 to your computer and use it in GitHub Desktop.
Robotics Assesment
function maxArea(height: number[]): number {
let i = 0 , j = height.length - 1 , maxA = 0
while(i < j){
let minH = Math.min(height[i] , height[j])
let width = j - 1
maxA = Math.max(maxA , (minH * width))
if(height[j] < height[i]) {
j -= 1
}else {
i+=1;
}
}
return maxA
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment