The thought process you explained was really amazing. Saying only Thank you for this is really less. My problem was never able to through 1D, 2D, or 3D dp. Now I understood why I couldn't. I revised my already-done DP problems with your techniques. This was really amazing. Thank you for providing such premium content for free.
@ashwint9597 ай бұрын
Excellent information regarding state and transition optimization. Never saw it in any book/video until now. I did solve a few problems and was getting TLE precisely because of this.
@Ankitagoyal-js4vh Жыл бұрын
last problem was amazing and the way u expalined each case is just amazing .... Thank You sir this amazing series
@secondarypemail7181 Жыл бұрын
In the Book shop problem if anyone is getting runtime error even after using iterative DP, make sure you are using int instead of long long int,it causes runtime error in Book shop problem.
@nsmworldentertainment4687 Жыл бұрын
Sir it would be better if u code atleast one of the question because this involves 2D table and it is very hard for beginners who are learning dp and some students to code it.
@harshitagnihotri40182 жыл бұрын
Priyansh Bhaiya thank you soo much ❤️ Bhaiya aap bhot aacha padhate hoo 🙏 Aapke liye bhot respect hai sir 🙏 Aap DP k baad baki DSA ki series bi laana hum zarur dekhenge 🙏🙏🙏
@edwardsnowden8749 Жыл бұрын
Please bring some long-video format content for segment trees🙏🙏🙏
@JayShankarpure2 жыл бұрын
Thanks for this amazing lecture series sir .
@Rohit_Gunwal27 күн бұрын
the approach in last que is not making much sense , why can't we take 3 scenarios dp[i][0] when last row had 2 growing blocks, 1 when last row had single growing block and 2 when both are not growing, for dp[i][0]: first possiblity mentioned was to close both blocks , then then we are saying the pos11 is bo th blocks are growing aren't these contradictory?
@deepakantoj4322 жыл бұрын
in the 3rd homework problem.... when it's a non-zero number why is that you're considering to fill up the same number again . suppose n = 5 , m = 5 array : 0 1 2 0 5 0 based indexing dp[1][1] = 1 // why when it's already filled with one shouldn't it be dp[1][1] = 0; or another way i can put this is If we can only change the value when A[i] == 0, then why do we care when A[i] == x?
@rishabpurba3268 Жыл бұрын
plss tell me if i am correct, in the homework problem 1 in the starting, dp[x][i] is basically we are constructing or finding the sum which are possible by the given coins right?
@mjustboring2 жыл бұрын
Combination 2 can be optimized... Here is how a[]
@mjustboring2 жыл бұрын
@Parth Nagarkoti 😂😂 It was way back when i was in 10th grade (i left it, may be was a mistake because it was growing)... But now i am a CS student...
@AnkitJosh2 жыл бұрын
great explanation.
@aayuushh192 жыл бұрын
Problem 2 is damn hard!
@aniketpriyadarshi2801 Жыл бұрын
You are a very good teacher.
@charan7754 ай бұрын
problem 3 is definitely a difficult one. If you think in terms of recursion, it will be easier to get recurrence relation
@RudraSingh-pb5ls2 жыл бұрын
Why won't we get tle in problem 2 when using dp[n][x] as state ? n is upto 1000 and x is upto 1e5 So n*x = 1e8, shouldn't this give us tle ?
@yaswanthmitta89837 ай бұрын
x is index not value
@SahilSangwan-z5fАй бұрын
this approach in coin combinations 2 is giving rte constraints are high
@nsmworldentertainment4687 Жыл бұрын
In question 1 how can dp[X][i]=1 there can be some cases where sum==X wont exist.?(for example with coins {2,4,6} it is not possible to get desired sum =5)
@gyanendrasaurav8779 ай бұрын
the first question can be solved by 1d dp itself
@digitalgandu15118 ай бұрын
very well explained, thankyou.
@nithishkumar4699 Жыл бұрын
In Coin Combinations II Problem, I am getting the correct output in online compilers but it is showing Run Time Error for all the test cases in CSES when submitted. What could be the mistake??
@SachinSingh-id8mf Жыл бұрын
use int instead of long long
@shitposting22348 ай бұрын
space optimise it
@rishav1442 жыл бұрын
thanks a lot for this series ....Very well explained
@RudraSingh-pb5ls2 жыл бұрын
Why won't we get tle in problem 2 when using dp[n][x] as state ? n is upto 1000 and x is upto 1e5 So n*x = 1e8, shouldn't this give us tle ?
@aniketpriyadarshi2801 Жыл бұрын
@@RudraSingh-pb5ls 1e8 would pass in one second.
@sakshamsengar97982 жыл бұрын
ummm i space optimised dice combinations 2 here please comment on this : really need ur point of view here #include using namespace std; #define int long long int #define endl ' ' #define all(x) x.begin(),x.end() #define mp make_pair #define pii pair #define ff first #define ss second #define pb push_back #define eb emplace_back #define rep(i,a,b) for(int i = a;i>x; vi v(n,0); rep(i,0,n)cin>>v[i]; sort(all(v)); int dp[x+1]; memset(dp,0,sizeof(dp)); dp[0] = 1; rep(i,0,n){ for(int j = 1;j=0){ dp[j] = (dp[j-v[i]]%mod + dp[j]%mod)%mod; } } } coutt; int t =1; while(t--){ solve(); } return 0; }
@dharsan.s79372 жыл бұрын
Its a fucking goat outside [if u know u know ]
@sunnyrawat9312 жыл бұрын
In problem 1 it gives tle when doing that process in reverse ie reducing sum to 0. won't it give tle while adding ?
@farj3946 Жыл бұрын
I am not able to code homework problem 3. can anyone help me
@harshprajapati27292 жыл бұрын
last Question OP!!
@taniabanerjee42292 жыл бұрын
thanks a lot🙂
@abhijeetfasate6131 Жыл бұрын
When will tle eliminators 7 start?
@iitianabhinandanpandey18Ай бұрын
💛
@fashionvella730 Жыл бұрын
dp[i][k]= no of ways to make money k by using i no of coins is it not making more sense
@md.shazidalhasan67264 ай бұрын
for me base case the is the most difficult
@deepnarayanpatra73002 жыл бұрын
What's that application on the left side of ZOOM in the dock menu 🙂🥲 Please anyone tell 😐🙏
@rishabh5072 жыл бұрын
OBS studio
@JayShankarpure2 жыл бұрын
Android Studio i guess
@ankitghosh98732 жыл бұрын
Awesome❤❤ also why don't u change the pen
@PriyanshAgarwal2 жыл бұрын
I have ordered an iPad. But that will arrive in a week so no pen changes in this bootcamp at least.
@RudraSingh-pb5ls2 жыл бұрын
@@PriyanshAgarwal Why won't we get tle in problem 2 when using dp[n][x] as state ? n is upto 1000 and x is upto 1e5 So n*x = 1e8, shouldn't this give us tle ?
@daveloperkrishana7559 Жыл бұрын
LOVELY 💖💖 never learned like this how to think dp everywhere on youtube is just memorization of dp problems
@SurajGaud2 жыл бұрын
Thanks bhaiya!!
@sahilanand302 жыл бұрын
🔥
@ekanshgupta29302 жыл бұрын
can we use maps in question 2
@raghavnandwana3646 Жыл бұрын
can someone provide the code for coin combinations 2 please in cpp
@farj3946 Жыл бұрын
I solve it by using dp[] only which is not same as priyansh taught here . Just interchange the loop of coin combinator 1 #include using namespace std; #define mod 1000000007 int main(){ int n , target; cin>>n>>target; int a[n]; for(int i = 0; i>a[i]; } vector dp(target+1 , 0); dp[0] = 1; for(int i = 0; i
@cse_33_ayandutta482 жыл бұрын
Cat and mouse leetcode wala karwa do please
@aniruddhadas16512 жыл бұрын
👍♥️👍
@abhishekranjan10942 жыл бұрын
Priyansh why all kickstart coder solve problem in C++... I want kickstart solutions in java??? please reply me 🙏🙏🙄🙄😓
@uptonogood3002 жыл бұрын
because java is trash for cp
@niteshsaxena038 ай бұрын
because C++ is best language for CP as it is faster
@chakshuverma81762 жыл бұрын
is it just me or the lecture 2 homwork questions were actually hard? 😔😔
@PriyanshAgarwal2 жыл бұрын
They were hard Yes. But watch lecture 3, I have covered all of them.
@harmitchhabra9892 жыл бұрын
Yeeeee
@SouravKumar-rg4yj2 жыл бұрын
💘💘💘🔥
@zasqqa60602 жыл бұрын
Course is awsome but we are here to learn coding not learning concepts so at the end of every exploration and explanation you should be coding as well...... I hate your long pre written template because u should be going like
@ajitkumarsingh871 Жыл бұрын
Sorry but I think he was here with intent of teaching dp concepts not how to code dp problems
@nsmworldentertainment4687 Жыл бұрын
can someone send code for loop for ques 1 using the same logic given in the video?