Minimum Number of Removals to Make Mountain Array | DP | Leetcode 1671

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 17

  • @neelgupta5952
    @neelgupta5952 หลายเดือนก่อน +1

    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.

    • @techdose4u
      @techdose4u  หลายเดือนก่อน +3

      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.

  • @DEEPAKKUMAR-wk5pk
    @DEEPAKKUMAR-wk5pk หลายเดือนก่อน +1

    Posting solutions to LC daily challenge. Thank you so much.

    • @techdose4u
      @techdose4u  หลายเดือนก่อน

      welcome:)

  • @GOPINATH-jx1su
    @GOPINATH-jx1su หลายเดือนก่อน +2

    Clear Explanation
    great teaching❤

    • @techdose4u
      @techdose4u  หลายเดือนก่อน

      Thanks :)

  • @saiei
    @saiei หลายเดือนก่อน +2

    god ur sir
    plz keep posting such vids, ur helping us

    • @techdose4u
      @techdose4u  หลายเดือนก่อน

      for sure :)

  • @kheersagarpatel3195
    @kheersagarpatel3195 หลายเดือนก่อน +2

    sir just by looking at the question, how much times it requires you to hit the solution?

    • @techdose4u
      @techdose4u  หลายเดือนก่อน +5

      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 😅

    • @kheersagarpatel3195
      @kheersagarpatel3195 หลายเดือนก่อน +1

      @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

    • @heybeachMIN
      @heybeachMIN หลายเดือนก่อน +1

      ​@@kheersagarpatel3195 Man, I want to reach your level, if you realised how to solve this problem. How many problems you solved before?

    • @kheersagarpatel3195
      @kheersagarpatel3195 หลายเดือนก่อน

      @@heybeachMIN around 300+ including examples of every topic in most detailed way

    • @kheersagarpatel3195
      @kheersagarpatel3195 หลายเดือนก่อน +1

      ​@@heybeachMIN around 300+ problems including examples of every topic in detailed way

  • @sailendrachettri8521
    @sailendrachettri8521 หลายเดือนก่อน