Recognizing Patterns in LeetCode Contest 476

It's Easy To Recognise Patterns 💪 Yes it's True But we unknowingly make some mistakes We'll talk about it some other day 🙃 Today let's focus on the patterns I found in the LeetCode weekly contest 476 For in detail explain watch this yt video https://lnkd.in/gcNhp6ET Q1 : Check The expression and Find out what to be done to get the max value possible Q2 : 2 strategies 1- Look at the root level and you will find that removing adjacent values works So use stack for adjacent 2- look what's the change to the rest of the string if we remove the current substring and this will lead you to abs(cnta-cntb) formula although it has an intuition as well, which I have shared in video Q3 : It's a direct digit dp question why ?? 1- we have to make numbers by choosing digits at every position 2- the constraints are high although you can use math as well which I have talked about in the video 😅 Q4 : We have to use prefix sum but it will cause some extra stable arrays so remove them as well how we thought about the prefix and all?? 🤣 I have talked in the video as well #leetcode #contest #cf #cp #dsa #coding

  • No alternative text description for this image

Nice explanation, I think I'm one who has overkilled 4th question using segment tree by carrying some node info. But this is a really cool trick. If interested, can check submission here: https://leetcode.com/problems/count-stable-subarrays/submissions/1832263229/

Amazing... Abb hoga comeback 💀

See more comments

To view or add a comment, sign in

Explore content categories