LeetCode Week 1 Summary + Divide&Conquer and More

Week 1 Summary of solving Leetcode coding interview problems daily. I will talk about harder versions of some problems.
All codes: github.com/Errichto/youtube/t...
0:34 Week Summary
3:05 Divide & Conquer (Max Subarray)
14:57 Best time to buy & sell, why greedy differences work?
18:32 Best time to buy & sell, Multiple units dp
20:07 Best time to buy & sell, Multiple units, greedy-ish solution
32:28 IOI 2015 problem "Horses"
Leetcode holds a 30-day Challenge in April with a new coding interview problem appearing each day. I'm participating and will upload a video for each day just after the deadline at midnight PST. Participate here leetcode.com/explore/featured...
Subscribe for more educational videos on algorithms, coding interviews and competitive programming.
- Github repository: github.com/Errichto/youtube
- Live streams on 2nd YT channel and on Twitch: / errichto2 & / errichto
- FB and Twitter: / errichto & / errichto
- Frequently Asked Questions: github.com/Errichto/youtube/w...
#Coding #Programming

Пікірлер: 95

  • @akashjain4281
    @akashjain42814 жыл бұрын

    Thanks for such detailed and high-quality content on the 30-day LeetCode challenge. I check out your videos every day after completing the day's challenge. It provides us with more insights and methods to solve the problems. Keep the good work going. Cheers!!

  • @Shubham-ny2ce
    @Shubham-ny2ce4 жыл бұрын

    This is what makes someone a pro... he do not know the solution but solutions........ Erricto : give me a problem , i will give you solutions . You may appreciate any solution....

  • @srishtipyasi2398
    @srishtipyasi23984 жыл бұрын

    You're the first person I've subscribed to on KZread. I'm learning a lot and hope to learn more from you! Hope you don't feel too rushed to make them and keep doing at your own pace! :) Appreciate the effort you put into making this!

  • @themispapavasileiou7872
    @themispapavasileiou78724 жыл бұрын

    I'm really loving this content. Very motivating to do the challenge along with these series. Keep it up and good luck for 1A!

  • @befrog57
    @befrog574 жыл бұрын

    Watched the whole thing! First of all, thank you so much for making it 🙏 I enjoyed it a lot and highly appreciate your effort. I'm fairly new to Competitive Programming, so I learned quite a lot from this video 👍You're just great as a teacher. A video series about solving techniques such as Divide & Conquer would be awesome!

  • @AbhishekKumar-gg6ox
    @AbhishekKumar-gg6ox4 жыл бұрын

    Bro, I am your fan. I love ur passion & dedication. I will also reach ur Programming level one day.

  • @ItumelengS

    @ItumelengS

    4 жыл бұрын

    Yeah he is good

  • @kaiovieira230

    @kaiovieira230

    4 жыл бұрын

    me too. I agree.

  • @ashwani_kumar_rai
    @ashwani_kumar_rai4 жыл бұрын

    Thanks errichto for all these tutorial getting a lot to learn from you please continue these things even after the lockdown goes away. Thanks a lot.☮️✌️

  • @Albert-ft4zl
    @Albert-ft4zl4 жыл бұрын

    I haven't seen the whole video yet! but I know you are awesome!

  • @sounakgupta1372
    @sounakgupta13724 жыл бұрын

    Bro, You are awesome. Your commitment to the community is impeccable.

  • @animeshpandey8727
    @animeshpandey87274 жыл бұрын

    Hi Errichto. I have been following your videos lately and I find them really helpful. A huge thanks to you. Can you please make a video explaining LeetCode's problem 'K-th Symbol in Grammar' !

  • @Player-ub9tg
    @Player-ub9tg4 жыл бұрын

    If you are searching for codes, the links are in the description, he forgot to say it in the beginning of the video

  • @hardikupadhyay9837
    @hardikupadhyay98374 жыл бұрын

    I loved this! Thanks so much

  • @CodersField
    @CodersField4 жыл бұрын

    21:22 FYI in stock market we can also sell first then we can buy it called a shorting of shares.

  • @nullnull6032
    @nullnull60324 жыл бұрын

    Hey man I love your videos I wish I can pay you so you can continue doing them :D Don't stop

  • @learnfromarandomguy7026
    @learnfromarandomguy70264 жыл бұрын

    Thank You for creating awesome contents. :)

  • @anushree3744
    @anushree37444 жыл бұрын

    Thanks for this video. Do you have summary of other weeks?

  • @oscargarries3896
    @oscargarries38964 жыл бұрын

    Awesome content!

  • @narayanbhat3279
    @narayanbhat32794 жыл бұрын

    Hey can enyone explain the third graph in best time to buy and sell stock, how did they graph it and how did they get the array?

  • @asurp7173
    @asurp71734 жыл бұрын

    Hi! You are doing a great job. How many problems should i solve every day to improve my problem solving skills?

  • @kabboghosh1853
    @kabboghosh18534 жыл бұрын

    u are such a great person

  • @nicolaswolyniec1354
    @nicolaswolyniec13544 жыл бұрын

    Thanks for the videos!Regarding the maximum consecutive subarray, basically we are using kadane's algorithm in the left and right side, right?

  • @iatadjanov
    @iatadjanov4 жыл бұрын

    Hi Errichto. Thanks for your videos. As I enjoy competitive programming I also enjoy watching your videos. For "Maximum Subarray" problem if we calculate the cumulative sums benefiting the current divide and conquer approach (O(1) time for each interval), we can achieve O(n) complexity for this problem in total, can't we (sum of geometric progression with O(1) complexity operations)?

  • @CodersField
    @CodersField4 жыл бұрын

    pro coder hehe :) enjoyed solutions

  • @philschmidt2104
    @philschmidt21044 жыл бұрын

    Thanks for such awesome content!

  • @sebastianmestre8971
    @sebastianmestre89714 жыл бұрын

    How do you solve the hard version of "when to buy and sell stock" using segment tree? I thought about it and the only way i can think of doing it uses lazy propagation, so i was wondering if that can be avoided

  • @Shubham-ny2ce
    @Shubham-ny2ce4 жыл бұрын

    Can you make a video on converting any recursion to dynamic. I personally feel trouble in memoization . deriving a formula for it as they are very different depending on the problem.

  • @samfailure213
    @samfailure2132 жыл бұрын

    Hi, I new to c++ and have a question. In the first problem, he call the function inside of the function itself to initialize for the variable ans. But how can that variable be returned in the first place for those "calling" of function? Or wouldn't it just go infinitely because of the creation of the subaarray? Can somebody help me wrap my head around this? Thanks in advance

  • @suvadeepghoshal
    @suvadeepghoshal4 жыл бұрын

    I am currently unable to understand the stock problem with DP, not so confident in Dp :(

  • @gauravsinghal516
    @gauravsinghal5164 жыл бұрын

    #Errichto Superb Explanation. Would love if you care to make a series of video for segment trees. It's one of those topics for which quality resources are quite scarce. Thanks for the effort!

  • @SourabhTripathi_i
    @SourabhTripathi_i4 жыл бұрын

    In the greedy solution for buy stocks problem how does it makes sure that at the end i have no stock ? i.e i sell all my stocks at the end

  • @theImpactSub
    @theImpactSub4 жыл бұрын

    Haven't heard about monotonic queues before this video. Can someone point out resources where to learn these kind of non-textbook data structures? Thanks in advance.

  • @suhendar977
    @suhendar9774 жыл бұрын

    Thank you i learn a lot from you. But i wanna more, What if you do live code fight with other youtuber programmer ? and who did solved problem first be the winner. its gonna be amazing content !

  • @Errichto

    @Errichto

    4 жыл бұрын

    I will do that after Leetcode April Challenge ends.

  • @aryangupta7022
    @aryangupta70224 жыл бұрын

    best video!

  • @soumyadipmondal9652
    @soumyadipmondal96524 жыл бұрын

    Errichto : The LeetCode challenge KZread Captions : Delete Code challenge

  • @andreykarayvansky9549
    @andreykarayvansky95494 жыл бұрын

    Blablabla! Thank you for the video!

  • @RiteshKumar-qk6uy
    @RiteshKumar-qk6uy4 жыл бұрын

    best programming related stuff on youtube . @Errichto Just one request, I am able to do A.B,C and very rarely D (with hint )problem in ccodeforces Div2 could you please make some video or give some tips to solve D,E and F . It's like I am little stuck in this moment to cross that barrier . By the way your content and approach to solve problem is awesome that is why you are legend :)

  • @manavmohata1240

    @manavmohata1240

    4 жыл бұрын

    Which year are u in?

  • @RiteshKumar-qk6uy

    @RiteshKumar-qk6uy

    4 жыл бұрын

    @@manavmohata1240 i did not get you .. why that is important ?

  • @manavmohata1240

    @manavmohata1240

    4 жыл бұрын

    @@RiteshKumar-qk6uy just asking

  • @RiteshKumar-qk6uy

    @RiteshKumar-qk6uy

    4 жыл бұрын

    @@manavmohata1240 1st year mtech

  • @lovvyparhar393
    @lovvyparhar3934 жыл бұрын

    Liked before watching!

  • @anands9407
    @anands94074 жыл бұрын

    bro can you do an explanation for the sudoku solver problem

  • @akhilyadav7426
    @akhilyadav74264 жыл бұрын

    bro your explanations for problems are super and love from India

  • @mariolim96
    @mariolim964 жыл бұрын

    good luck for code jam !

  • @mikemihay
    @mikemihay4 жыл бұрын

    Can you do Python code instead of C++ ? or both of them

  • @lovvyparhar393
    @lovvyparhar3934 жыл бұрын

    making two subvectors make it easy to understand and apply, but should we worry about the time it takes to make sub vectors and use two pointers? is the time added considerable?

  • @Errichto

    @Errichto

    4 жыл бұрын

    It would be faster to just keep one vector/array and keep passing indices of left and right end recursively, yes.

  • @yiminglin8716
    @yiminglin87164 жыл бұрын

    Hi Errichto, thanks for the summary! Can I ask what your setup is for writing and illustrating, i.e. the software and hardware?

  • @Errichto

    @Errichto

    4 жыл бұрын

    OneNote for drawing, and read my FAQ github.com/Errichto/youtube/wiki/FAQ#computer-configuration-os-ide-keyboard-etc

  • @yiminglin8716

    @yiminglin8716

    4 жыл бұрын

    @@Errichto Thanks!

  • @jhashivam28
    @jhashivam284 жыл бұрын

    Please solve codechef April challeng problem STRNO plzzz plzz

  • @kunal_chand
    @kunal_chand4 жыл бұрын

    How about building a team that will edit ur videos and handle ur KZread channel. Basically you get to code and leave all the social media work to your management team

  • @Errichto

    @Errichto

    4 жыл бұрын

    I think I must do this in the long run, but most time is editing and it's just part of what the video will be. I know what I want to convey, and white editing I check for mistakes :/ a random person won't do that well

  • @suvadeepghoshal

    @suvadeepghoshal

    4 жыл бұрын

    @@Errichto: at least try for monetization now. Your content and quality have improved. Financial independence is essential! Huge love and respect from India

  • @aanchalsharma5264
    @aanchalsharma52644 жыл бұрын

    I am finding all these very difficult 😔

  • @shivaraj-bh
    @shivaraj-bh4 жыл бұрын

    Is it possible to solve the DP approach of buying and selling stock using Convex Hull Trick?

  • @Errichto

    @Errichto

    4 жыл бұрын

    I don't think so, but maybe parametric search (trick from Aliens) will do the job.

  • @shivaraj-bh

    @shivaraj-bh

    4 жыл бұрын

    @@Errichto I think even parametric search exploits the convex nature of a cost function, which is similar to what Convex Hull Trick does, isn't it?

  • @Errichto

    @Errichto

    4 жыл бұрын

    @@shivaraj-bh Convex Hull Trick makes sense for linear/quadratic cost functions only, while parametric search doesn't have that limitation (but it has a requirement of f(k) being convex where k is number of used objects/transactions).

  • @shivaraj-bh

    @shivaraj-bh

    4 жыл бұрын

    @@Errichto Yeah right. I will try implementing using parametric search.

  • @PasselivreEdicoes
    @PasselivreEdicoes4 жыл бұрын

    For harder problem of divide and conquer, can't you solve it with MaxQueue + Sliding Windows? (if that's what a Monotonic Queue is, I'm sorry I don't really know that with that name). For divide and conquer solution, if I understand correctly, you store prefix and suffix maximum and get max of every prefix + sufix such that size of suffix is Y and prefix is K - Y?

  • @Errichto

    @Errichto

    4 жыл бұрын

    Monotonic Queue is exactly O(N) max queue with sliding window. Yes, you are right about Y and K-Y thing.

  • @PasselivreEdicoes

    @PasselivreEdicoes

    4 жыл бұрын

    @@Errichto Alright thanks a lot

  • @Pctech4uproductions
    @Pctech4uproductions4 жыл бұрын

    There are no timestamps in the description :(

  • @Errichto

    @Errichto

    4 жыл бұрын

    Added now :)

  • @Pctech4uproductions

    @Pctech4uproductions

    4 жыл бұрын

    @@Errichto 10q

  • @mithildevisetty5754
    @mithildevisetty57544 жыл бұрын

    Errichto, can you solve the same problems in java which would be helpful to many others.

  • @rajdave9862
    @rajdave98624 жыл бұрын

    Hey my dear, Please let us know how did you done that too faster? How are you practicing and from where to become master at DSA?

  • @merajhussain7450
    @merajhussain74504 жыл бұрын

    Errichto I am a huge fan of yours!! do u code all the day or u even work somewhere!!!! Why don't u do some q&a session?

  • @080rohitdatta2

    @080rohitdatta2

    4 жыл бұрын

    check the description. And read FAQ

  • @SinghSidhuKuldeep
    @SinghSidhuKuldeep4 жыл бұрын

    Live Streams? 😧😱

  • @freeme6111
    @freeme61114 жыл бұрын

    Create your own course and i will buy it

  • @nullnull6032

    @nullnull6032

    4 жыл бұрын

    +1

  • @audiogear4412
    @audiogear44124 жыл бұрын

    He is good at competition, but sucks at explanation.

  • @kalenzo78

    @kalenzo78

    4 жыл бұрын

    Watch Netflix bro...You an the wrong street

  • @angiras07

    @angiras07

    4 жыл бұрын

    You wrong

  • @angiras07

    @angiras07

    4 жыл бұрын

    @@audiogear4412 lol

  • @audiogear4412

    @audiogear4412

    4 жыл бұрын

    Watch the complete video before giving me any comments.

  • @Errichto

    @Errichto

    4 жыл бұрын

    Say exactly what explanation was bad (maybe with timestamps?) and I will be happy to improve on that in the future ;)

  • @narayanbhat3279
    @narayanbhat32794 жыл бұрын

    Hey can enyone explain the third graph in best time to buy and sell stock, how did they graph it and how did they get the array?