nice one here s two pointer approach public class Solution { public int trap(int[] h) { int l = 0, r = h.length - 1, lmax = Integer.MIN_VALUE, rmax = Integer.MIN_VALUE, ans = 0; while (l < r) { lmax = Math.max(lmax, h[l]); rmax = Math.max(rmax, h[r]); if(lmax
@FifthArima9 ай бұрын
This one is the simplest way to solve, easy to understand and is good for starters. I'd say decent for an interview. Yet there are different approaches to this problem 1. Using DP 2. Using two pointers 3. Using monotonic stack . The two pointer is the most optimal solution with no extra space. I would always advise folks to know all the possible ways to solve a problem. so that you have the edge when asked for optimization during follow ups !
@gokulnath589 Жыл бұрын
Pakka code bro🔥🔥 yepdi bro neenga mattum ipdiala yosikiringa vere Mari bro superb 🤝🤝🤝
@r.prabhakaraarjun67964 ай бұрын
Mass bro neee...... Nalla sonninga!
@yadeshwararamm82603 жыл бұрын
Superb bro. ... I want more Qestions like this......🔥🔥🔥
@AlgoTamizha3 жыл бұрын
sure🙌. keep supporting and sharing. thanks
@susmithamohan81502 ай бұрын
Thanks a lot it seems super easy now
@mohamedfaizal43605 ай бұрын
super bro. crystal clear explanation.
@selvaragavan_10 Жыл бұрын
Annae mass nae nee🙌🏻❤️
@mohammedimthiyas52774 ай бұрын
Super bro
@TheVinothg3 жыл бұрын
Great Explanation!!
@srinivas37779 ай бұрын
super explanation bro
@RadhamaniRamadoss2 жыл бұрын
Excellent bro.. I am able to easily understand the problem after watching your video and was able to code in Python
@AlgoTamizha2 жыл бұрын
thats awesome. keep up the great work 👍
@aldricanto77244 ай бұрын
tamil nadu oda striver bro neenga
@abhineveash5 ай бұрын
❤❤❤
@gokul44763 жыл бұрын
Niceee❤️
@RaichuTheLegend Жыл бұрын
bro zoho la entha question kettaga bro. level 2 on 27th December 2023
@gokulnath589 Жыл бұрын
Pls upload array medium level important questions for freshers