Doubt: When we are calculating the mountain size for index=2..Are we saying, keeping element at index 2 as peak element, what will be the mountain size?... If we see the mountain size with index 2 element, would be zero...since it is not forming the mountain with 2...Please correct me, if there is any gap in my understanding?...you have mentioned that, with element at index 2 as peak, the mountain size will be 4...but 2 is not forming any mountain.
Yes correct. However, since the question guarantees a mountain array hence you will end up with an optimal answer :) That clip explaining your doubt I removed as I thought people will be confused :) It doesnt matter whether my assumed element is peak or not. Joising 2 LIS LR & RL will always have a peak. ex. 1,4 LIS_LR 1,2,6,8 LIS_RL Len 2 & Len 4. Do we have 4 as peak ? NO But still we can join them to make a miuntain array :) New peak = 8 Since we dont need to say which element is peak, but just Length. Therefore, our technique of assuming peak works :) It doesnt have to be peak as I said Moreover, since we are trying with every element as being peak, hence we will definitely end up with 8 being peak at some point of time. I wish you got it :) Good question. I shouldnt have cut the clip explaining this. Hence pinned your COMMENT.
@techdose4u ok sir So how many problems at least needed to get that level. For this problem i also realised as soon as i saw. Hoping to reach your level one day
Doubt:
When we are calculating the mountain size for index=2..Are we saying, keeping element at index 2 as peak element, what will be the mountain size?... If we see the mountain size with index 2 element, would be zero...since it is not forming the mountain with 2...Please correct me, if there is any gap in my understanding?...you have mentioned that, with element at index 2 as peak, the mountain size will be 4...but 2 is not forming any mountain.
Yes correct.
However, since the question guarantees a mountain array hence you will end up with an optimal answer :)
That clip explaining your doubt I removed as I thought people will be confused :)
It doesnt matter whether my assumed element is peak or not.
Joising 2 LIS LR & RL will always have a peak.
ex.
1,4 LIS_LR
1,2,6,8 LIS_RL
Len 2 & Len 4.
Do we have 4 as peak ?
NO
But still we can join them to make a miuntain array :)
New peak = 8
Since we dont need to say which element is peak, but just Length.
Therefore, our technique of assuming peak works :)
It doesnt have to be peak as I said
Moreover, since we are trying with every element as being peak, hence we will definitely end up with 8 being peak at some point of time.
I wish you got it :)
Good question.
I shouldnt have cut the clip explaining this.
Hence pinned your COMMENT.
Posting solutions to LC daily challenge. Thank you so much.
welcome:)
Clear Explanation
great teaching❤
Thanks :)
god ur sir
plz keep posting such vids, ur helping us
for sure :)
sir just by looking at the question, how much times it requires you to hit the solution?
I will not be a good person to compare with any student as I have seen a lot of problems so nothing seems new to me 😅
@techdose4u ok sir
So how many problems at least needed to get that level.
For this problem i also realised as soon as i saw.
Hoping to reach your level one day
@@kheersagarpatel3195 Man, I want to reach your level, if you realised how to solve this problem. How many problems you solved before?
@@heybeachMIN around 300+ including examples of every topic in most detailed way
@@heybeachMIN around 300+ problems including examples of every topic in detailed way
:)