Arrays Series #14- Trapping Rainwater Problem- Intuition + Dry run + Live code - (Java)

Описание к видео Arrays Series #14- Trapping Rainwater Problem- Intuition + Dry run + Live code - (Java)

Given an array arr[] of N non-negative integers representing the height of blocks. If width of each block is 1, compute how much water can be trapped between the blocks during the rainy season.


Example 1:

Input:
N = 6
arr[] = {3,0,0,2,0,4}
Output:
10
Explanation:

Example 2:

Input:
N = 4
arr[] = {7,4,0,9}
Output:
10
Explanation:
Water trapped by above
block of height 4 is 3 units and above
block of height 0 is 7 units. So, the
total unit of water trapped is 10 units.
Example 3:

Input:
N = 3
arr[] = {6,9,9}
Output:
0
Explanation:
No water will be trapped.

👉👉Practice here -

https://practice.geeksforgeeks.org/pr...

https://leetcode.com/problems/trappin...

============================================================
Other playlists in the channel that you can follow:

➡️ Recursion Primer Series -    • Recursion Primer Series  
➡️ String coding interview questions -    • String interview questions  
➡️ Arrays Series -    • Arrays Series  
➡️Linked List Series -    • Linked List Series  
➡️ Sorting Primer Series -    • Sorting primer series  
➡️ Binary Search Series -    • Binary Search Series  
=======================================================

Please click the LIKE button so that this kind of content can be seen by as many as possible aspiring engineers and professionals. Doing so gives me even more motivation to post such content in the future.
Please comment below and let me know if you have any questions or concerns.

Additionally, don't forget to click the bell symbol to receive notifications and subscribe to the channel.
Follow us on:
➡️Twitter -   / codeease  
----------------------------------------------------------
Created and Instructed by:
Varsha Das
Mid-senior Software Engineer, Content Curator of @Code With Ease

➡️ LinkedIn -   / varsha-das-se  
➡️ Quora - https://www.quora.com/profile/Varsha-...
➡️ Hashnode - https://varsha-das.hashnode.dev/
➡️ Medium -   / varshadas21  


Code With Ease is meant to make problem-solving in programming easier. For DSA preparation, we post topic-specific videos pertaining to Coding Interview topics so that everyone may approach such questions with a clear thought process and achieve the best outcomes. In addition, we make an effort to include different "Primer Series" that teach particular concepts or algorithms. We want to be the one-stop solution for everything pertaining to DSA preparation and programming foundations in general, saving candidates from having to visit many sources in order to receive structured content.
Additionally, we believe that learning to code entails much more than only "cracking the coding interview." The long-term goal of this channel is to create more proficient problem-solvers in this field so that, in the end, we can create fantastic products and be able to resolve challenging issues in our environment to improve the quality of life for everyone.

#trappingrainwater #rainwatertrappingproblem #codinginterviewquestions #coding #leetcodehard #arraysinjava



trapping rain water problem in java
trapping rain water problem
trapping rain water
a gallery with plants is divided into n parts, numbered 0, 1, 2, 3, ..., n-1. there are provisions for attaching water sprinklers in every division. a sprinkler with range x at division i can water all divisions from i-x to i+x. given an array gallery[] consisting of n integers, where gallery[i] is the range of the sprinkler at partition i (a power of -1 indicates no sprinkler attached), return the minimum number of sprinklers that need to be turned on to water the entire gallery. if there is no possible way to water the full length using the given sprinklers, print -1.
rainwater trapping problem

Комментарии

Информация по комментариям в разработке