←ENG-DSA-066Optimal Server Rack Cooling (Two Pointers)
00:00
🐍 Python Idle
Mode:Web

Optimal Server Rack Cooling (Two Pointers)

CompaniesGoogle, Meta
Est. Time~30 min
LevelMid
Two PointersGreedyArrays
🚨 P0 Incident
GoogleMeta

Datacenter aisle containment relies on calculating the physical volume of cold air trapped between server racks of varying heights. To optimally place the heaviest computing workloads, infrastructure engineers must identify the two server racks across a floor plan that create the largest physical containment zone.

πŸ“₯ Assigned to:You β€” Mid Engineer
Your Task

Given an array of server rack heights, choose two racks such that, combined with the floor between them, they form a container that holds the most volume (area). You cannot slant the container. Return the maximum area.

⏱ Time: O(N)πŸ’Ύ Space: O(1)
Example 1
Input:Β Β heights=[1,8,6,2,5,4,8,3,7]
Output:Β 49
Example 2
Input:Β Β heights=[1,1]
Output:Β 1
πŸ”’ +3 hidden test cases β€” revealed on Submit
Hints
Loading editor…
Test Output
β–Ά Run Code to test against examples Β· Submit to judge all 5 test cases
EngPrep β€” Real Engineering. Real Interviews.