Programming Question : Leetcode 11

  1. In this question, we are asked to calculate area between two bars, that will be calculated as (distance between bars)*(height of smaller bar).
  2. we will start two pointers one from start and other from end , and keep calculating area between the bars. Now, as we need smaller bars(because water can be filled up to the height of smaller bar) so if right side bar is smaller , we will decrement its pointer and if left side bar is smaller we will decrement its pointer until start is less than or equal to end.
  3. at the end we will return maximum area .

--

--

--

!Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

2D Snake Game In Flutter & Hummingbird

🌎Vero Farm Around The Globe🌎

Building e-satisfaction v2.0

Professor, Reader, Lecturer & Other — 27 Posts

Does Team Ramp Up Guarantee Increased Feature Velocity?

Django Many To One Relations

KYVE Incentive testing network launched

A Hardware Guide: Actually getting CUDA to accelerate your Data Science for Ubuntu 20.04

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Raj shukla

Raj shukla

!Engineer

More from Medium

Leetcode problem: Solving Questions With Brainpower

Longest Substring with No Repeating Characters Using Python 🐍| Coding Interview | Sliding Window…

Longest substring with no repeat characters

Implementing Linked List Operations in Python

733. Flood Fill