Algorithm · Airbnb · Hard
Requirements Part 1 — Draw the terrain Input: heights = [5, 4, 3, 1, 3, 4, 5]. Display an ASCII diagram in which column i contains heights[i] stacked + symbols rising from one common baseline. This picture follows directly from the column heights: the outer columns reach height 5, while the center column reaches only height 1. Part 2 — Pour water dumpWater(heights, waterAmount, c) releases W water units above column c. For every individual unit: It first attempts to move…
Checking your access…