PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Oracle

Maximize area between vertical lines

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic reasoning with arrays and the ability to optimize pairwise measurements, specifically assessing understanding of how positional distance and element values combine to maximize an area metric.

  • medium
  • Oracle
  • Coding & Algorithms
  • Software Engineer

Maximize area between vertical lines

Company: Oracle

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## Problem You are given an integer array `h` where `h[i]` represents the height of a vertical line drawn at x-coordinate `i`. Choose **two different indices** `i < j`. Together with the x-axis, these two lines form a container that can hold water. The amount of water the container can hold is: \[ \text{area}(i, j) = (j - i) \times \min(h[i], h[j]) \] Return the **maximum possible area** over all pairs `(i, j)`. ### Input - `h`: array of non-negative integers ### Output - An integer: the maximum area ### Constraints (typical interview constraints) - `2 <= len(h) <= 10^5` - `0 <= h[i] <= 10^4`

Quick Answer: This question evaluates algorithmic reasoning with arrays and the ability to optimize pairwise measurements, specifically assessing understanding of how positional distance and element values combine to maximize an area metric.

Related Interview Questions

  • Solve Five Coding Problems - Oracle (medium)
  • Compute letter frequencies from encoded string - Oracle (medium)
  • Count closed islands in a grid - Oracle (easy)
  • Implement in-memory data structures and booking API - Oracle (hard)
  • Implement an LRU cache - Oracle (medium)
Oracle logo
Oracle
Jan 4, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0
Loading...

Problem

You are given an integer array h where h[i] represents the height of a vertical line drawn at x-coordinate i.

Choose two different indices i < j. Together with the x-axis, these two lines form a container that can hold water.

The amount of water the container can hold is:

area(i,j)=(j−i)×min⁡(h[i],h[j])\text{area}(i, j) = (j - i) \times \min(h[i], h[j])area(i,j)=(j−i)×min(h[i],h[j])

Return the maximum possible area over all pairs (i, j).

Input

  • h : array of non-negative integers

Output

  • An integer: the maximum area

Constraints (typical interview constraints)

  • 2 <= len(h) <= 10^5
  • 0 <= h[i] <= 10^4

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Oracle•More Software Engineer•Oracle Software Engineer•Oracle Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.