Calculating trapped water

Hard

Suppose you're given an array of positive integers representing a 2-D stack of logs where each element is 1 unit wide and each element in the array represents the height of the logs. When it rains, suppose all spots between the logs are filled up....

Sign in to InterviewQs to view this question

Or

New to InterviewQs? Sign up now.

By proceeding, you agree to our Terms and Conditions and Privacy Policy.

Loading editor...