03 - Elementary Problem (Dynamic Programming for Beginners)

  Рет қаралды 42,556

Andrey Grehov

Andrey Grehov

Күн бұрын

Пікірлер: 79
@andreygrehov
@andreygrehov 4 жыл бұрын
Next video: kzbin.info/www/bejne/h523ZXt9bph6l9k Previous video: kzbin.info/www/bejne/ZoXYXnqIgsSfe5I
@sairamankilambi5007
@sairamankilambi5007 4 жыл бұрын
I've been searching for dp tutorials and I have to say this is the best dp tutorial ever... Really appreciate it👍
@andreygrehov
@andreygrehov 4 жыл бұрын
Thank you so much, Sai
@pythonxz
@pythonxz Жыл бұрын
What a beautiful way to break down how to define the kinds of problems dynamic programming helps with.
@darshantawte7435
@darshantawte7435 4 жыл бұрын
Best DP course I have stumbled upon.Keep up the good work Mr Andrey!!
@starbloods0013
@starbloods0013 4 жыл бұрын
I'm so happy I found this course. I love my school but sometimes my professors can't really explain concepts that well. You explain things so well! Thank you!
@mrrobotnik_
@mrrobotnik_ 4 жыл бұрын
Thanks for the tutorial, i'll be waiting for more videos, keep doing them. Much appreciation from Brazil. Bom Trabalho.
@andysong8085
@andysong8085 2 жыл бұрын
func nSumRecursion(n int) int { if n == 0 { return 0 } if n == 1 { return 1 } return n + nSumRecursion(n-1) } Hi Andrey, I will contribute one Recursion version of nSum. I think pretty much someone is looking for recursion version as DP always be couple with recursion at the same time. Hope my contribution makes sense to you.
@shritishaw7510
@shritishaw7510 3 жыл бұрын
please let me know whether I am right or not combinatorics problem means "HOW MANY WAYS ARE THERE TO DO A JOB" and optimization problem means "WHAT IS THE BEST POSSIBLE WAY TO DO A JOB"
@damaroro
@damaroro 2 жыл бұрын
sweet jesus , I've been looking for very beginner DP programming course for a weeks, since I'm not from CS background, I found many DP course in youtube is really HARD, but this is an exception, I would love to see more Data structure and Algorithm course from your channel, you're such a good teacher
@yexijiang
@yexijiang 4 жыл бұрын
Curious how do you stay focus while the kids are around. That's also an important skill to work from home during this time period.
@andreygrehov
@andreygrehov 4 жыл бұрын
Oh man, that's a good question. It's tough, but luckily, I have my own "office" - a small room where I both record these videos and do all the work.
@yaxlu
@yaxlu 4 жыл бұрын
Watching these videos in loop - very well done. Glad I stumbled upon them. Thank you ( a ton of times) for making these videos. Please keep doing it (more).
@pedrocolangelo5844
@pedrocolangelo5844 3 жыл бұрын
I found out your dynamic programming lectures playlist today and I am so excited about finishing it! Going to the 4th lecture right now. Thank you for posting these!
@TheAmron90
@TheAmron90 4 жыл бұрын
Wow I have never understood the fundamentals this well. Knowing the problem statement well, it was easier to understand the solution. Usually videos are describing a complicated problem at the start, which makes it difficult to understand. Thanks :)
@saraahmed408
@saraahmed408 Жыл бұрын
Thank you so much, DP was giving me such hard times! I watched a lot of videos, but yours are the ones that made me understand! Thank you
@theremin1441
@theremin1441 3 ай бұрын
linear runtime: def sum(n): return (n+1)*(n/2)
@cutiex7357
@cutiex7357 3 жыл бұрын
WHY is this so therapeutic 🙈 Love it!
@andreygrehov
@andreygrehov 3 жыл бұрын
Haha, thank you, @Cutie :)
@ichekaozuru1979
@ichekaozuru1979 3 жыл бұрын
Thank you, Mr Grehov. I love your channel. Thank you for this awesome series.
@Mridul2k24
@Mridul2k24 4 жыл бұрын
Thanks for this great video lecture series ,these lectures are really helpful . Lots of love and appreciation from India.
@AkkumBakkum-m5h
@AkkumBakkum-m5h 6 ай бұрын
i m in love with dp after watching your videos thank you so much
@acidroot7126
@acidroot7126 4 жыл бұрын
Free great tutorial, thank you! It’s really cool explanation !
@mohammedalhaj1516
@mohammedalhaj1516 9 ай бұрын
this course is very beneficial, great work thank you for your time.
@Benjamin-Chavez
@Benjamin-Chavez 3 жыл бұрын
Thanks again. This course is exactly what I needed.
@mfandrade
@mfandrade 9 ай бұрын
Awesome lecture! Thank you so much, Andrey!
@Enzoerb
@Enzoerb 5 ай бұрын
What an amazing course!!
@rahulyadav8159
@rahulyadav8159 4 жыл бұрын
Loved your explanation.. Waiting for next cool video.
@shashankdhanai7608
@shashankdhanai7608 2 жыл бұрын
first time using dp this videos are really helpfull...
@amrilsan9299
@amrilsan9299 Жыл бұрын
Sir, your tutorial is very easy to understand, Big Thanks
@subid.majumdar
@subid.majumdar 3 жыл бұрын
Best lectures available on internet, please sir make more videos on different topics
@yeffdev
@yeffdev 4 жыл бұрын
Hi Andrey, any books with exercises and examples you recommend? Many thanks for your content!
@raghavddps2
@raghavddps2 4 жыл бұрын
Awesome video Andrey! Thank you so much for this course. On a side note, can you please suggest some good resources to learning GoLang ?. Thank you again for the Awesome content.
@andreygrehov
@andreygrehov 4 жыл бұрын
Thank you, Raghav. As for Golang, here is a super quick intro to the language: tour.golang.org/welcome/1 The next step would be to go through a course or read a book. Here is a small book that is available for free: www.golang-book.com/books/intro It's slightly outdated, but a lot of stuff still holds. Also, check this link out: golang.org/doc/ It has a ton of useful up-to-date information. Go is a small, but very powerful language. One can learn it within a day or two.
@raghavddps2
@raghavddps2 4 жыл бұрын
@@andreygrehov Wow, thank you for these resources too. You are just awesome! Thank you so so much.
@mariestolk3794
@mariestolk3794 9 ай бұрын
Your videos are amazing! Thank you so much for making these :)
@sandippaul100
@sandippaul100 3 жыл бұрын
Great video... So the concept is we are storing previous results for future use. In some sense can I say that we are reducing time requirements by using extra space?
@virtyaluk
@virtyaluk 4 жыл бұрын
Excellent work. Thank you.
@604motorsports
@604motorsports 11 ай бұрын
Thanks for the video. But, in this case, there is no benefit as you have to sum from 1 to n anyways, so what is the benefit of dp in this case or other cases?
@mihirsidhdhapurasensei
@mihirsidhdhapurasensei 4 жыл бұрын
Amazing. my fundamental now super solid. thanks to u sir;)
@ladydimitrescu1155
@ladydimitrescu1155 Жыл бұрын
Awesome course!
@StackJobs
@StackJobs Жыл бұрын
明白了。动态规划核心思想就是拿到一个大问题,先从这个大问题的一个小问题开始,小步迭代,推导出后面的问题和当前的问题的函数关系,最终把整个大问题都解决掉。
@StackJobs
@StackJobs Жыл бұрын
Thank you, nice explanation. I got it.
@jerrycheung8158
@jerrycheung8158 Жыл бұрын
great lecture, thanks Andrey. For the example you gave, is it also a recurrsion problem? How do I differentiate these 2 types of problem?
@Alexey1st
@Alexey1st 4 жыл бұрын
Why did you create array with size n+1? The loop works while i
@andreygrehov
@andreygrehov 4 жыл бұрын
The n+1 is needed because of the base case, we store it at index 0. If I were to find the sum of only 1 element, the subproblems array would contain [0, 1], hence two elements (n=1 but the array size is n+1). Here, check it out: play.golang.org/p/z3RZyk8BS3v Does it make sense?
@Alexey1st
@Alexey1st 4 жыл бұрын
​@@andreygrehov Yeah, make sense. Thanks a lot for your efforts! Very appreciated.
@goshapoopkin
@goshapoopkin 7 күн бұрын
thank you for doing this, it is really appreciated. can i just ask what language did you use to write the code?
@andreygrehov
@andreygrehov 7 күн бұрын
Thank you. The code is in Go Programming Language.
@bouzekriredouane485
@bouzekriredouane485 4 жыл бұрын
why not using a simple loop like that : int sums(int n){ int result = 0; for(int i = 0; i < n+1; i++) result += i; return result; }
@andreygrehov
@andreygrehov 4 жыл бұрын
As I said, the problem in the video is just for demonstration purposes only. We obviously do not need DP here, it's just to let you feel what DP is.
@JustVideoClub
@JustVideoClub 2 жыл бұрын
Hii bro i am learning dp in python and now where can i get that code
@monishnjs
@monishnjs 3 жыл бұрын
How many ways and find maximum are same right?
@recce-tp9zj
@recce-tp9zj 3 жыл бұрын
Great Videos.
@anubhavsethi3416
@anubhavsethi3416 4 жыл бұрын
Looking forward for more videos
@andreygrehov
@andreygrehov 4 жыл бұрын
Working on it
@nyashachiroro2531
@nyashachiroro2531 Жыл бұрын
4:51 That was a perfect definition Jesus 😂
@32ask92
@32ask92 Жыл бұрын
thank you for your help really appreciate it :)
@glensee7506
@glensee7506 3 жыл бұрын
I love it, thanks!
@sap1363
@sap1363 4 жыл бұрын
great video. Which keyboard do you use ?
@andreygrehov
@andreygrehov 4 жыл бұрын
I use Macbook Pro.
@natnav3436
@natnav3436 3 жыл бұрын
Hi, this is a great course. I tried to do the example in java using your technique and I was able to solve it public int addFirst(int n){ int[] h = new int[n + 1]; h[0] = 0; for (int i = 1; i
@andreygrehov
@andreygrehov 3 жыл бұрын
Good job! Yes, that is still considered DP. In fact, you optimized space complexity from O(N) to O(1).
@natnav3436
@natnav3436 3 жыл бұрын
@@andreygrehov Thank you
@ConernicusRex
@ConernicusRex 11 ай бұрын
In Swift: func nSum(_ n: Int) -> Int { guard n != 0 else { return 0 } var dp: [Int] = [0] for i in 1...n { dp.append(dp[i - 1] + i) } return dp[n] }
@josueteodoromoreira8921
@josueteodoromoreira8921 4 жыл бұрын
Thank you so much!!!
@ethernet764
@ethernet764 3 ай бұрын
Code in C if anyone wants: int nSum(int n) { int *dp= alloca(1 + (n * sizeof(nSum(n)))); dp[0] = 0; for (int i = 1; i
@salmaelziady4386
@salmaelziady4386 Жыл бұрын
what kind of programming language is this? what ide is this?
@andreygrehov
@andreygrehov Жыл бұрын
Programming Language: Go (go.dev/) IDE: Intellij (www.jetbrains.com/idea/)
@glennpavel4800
@glennpavel4800 3 жыл бұрын
good job
@MukilShelby
@MukilShelby 3 жыл бұрын
so underrated channel....
@hocineabderrahmane3027
@hocineabderrahmane3027 Жыл бұрын
int sum(int *numbers, int n){ if(numbers[n] != 0) return numbers[n]; if(numbers[n-1] == 0) numbers[n-1] = sum(numbers, n-1); return numbers[n-1] + n; }
@erikdali983
@erikdali983 3 жыл бұрын
I wish the code was in Python or C++.
@VishalJangid1
@VishalJangid1 4 жыл бұрын
"What is the maximum profit gained by buying and selling a stock?" this can be solved by divide and conquer
@II_xD_II
@II_xD_II 4 жыл бұрын
pref sum
@edwardduong6914
@edwardduong6914 27 күн бұрын
Somehow you look like Victor Perkins to me.
@andreygrehov
@andreygrehov 23 күн бұрын
lol
@RedOxBangla
@RedOxBangla Жыл бұрын
C language code #include int sumf(int n){ int dp[n+1]; dp[0]=0; for(int i=1;i
09 - Unique Paths (Dynamic Programming for Beginners)
29:17
Andrey Grehov
Рет қаралды 15 М.
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,5 МЛН
МЕНЯ УКУСИЛ ПАУК #shorts
00:23
Паша Осадчий
Рет қаралды 5 МЛН
Lecture 19: Dynamic Programming I: Fibonacci, Shortest Paths
51:47
MIT OpenCourseWare
Рет қаралды 2,8 МЛН
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
02 - What is DP? (Dynamic Programming for Beginners)
11:05
Andrey Grehov
Рет қаралды 52 М.
07 - Optimization Problem (Dynamic Programming for Beginners)
9:32
Andrey Grehov
Рет қаралды 27 М.
5 Simple Steps for Solving Dynamic Programming Problems
21:27
Reducible
Рет қаралды 1,1 МЛН
11. Top-Down vs. Bottom-Up (Dynamic Programming for Beginners)
18:11
Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges
5:10:02
Algorithms: Memoization and Dynamic Programming
11:17
HackerRank
Рет қаралды 973 М.
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 199 М.
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,5 МЛН