GDSC-IGDTUW-Autumn-of-Code-2022 / ip-questions-2023

INTERVIEW PRACTICE
0 stars 4 forks source link

Trapping rain water #2

Open Khxshx opened 1 year ago

Khxshx commented 1 year ago

Given an array of N non-negative integers arr[] representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.

Examples:

Input: arr[] = {2, 0, 2} Output: 2 Explanation: The structure is like below. Untitled-Diagram711

We can trap 2 units of water in the middle gap.

Input: arr[] = {3, 0, 2, 0, 4} Output: 7

Explanation: Structure is like below. Untitled-Diagram811

We can trap “3 units” of water between 3 and 2, “1 unit” on top of bar 2 and “3 units” between 2 and 4.

chinmaychahar commented 1 year ago

Kindly assign this to me.

jain-shreyaa-1808 commented 1 year ago

@Khxshx assign this issue to me I can solve it in best time and space complexity

meghaaroraa commented 1 year ago

@Khxshx please assign this issue to me

BhavyaDevani commented 1 year ago

@Khxshx pls assign this issue to me