State & Transition Optimization | Dynamic Programming Bootcamp | Day 3/6 | IIT Gandhinagar

  Рет қаралды 24,221

Priyansh Agarwal

Priyansh Agarwal

Күн бұрын

Пікірлер: 65
@biplabroy1406
@biplabroy1406 Жыл бұрын
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.
@ashwint959
@ashwint959 7 ай бұрын
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
@Ankitagoyal-js4vh Жыл бұрын
last problem was amazing and the way u expalined each case is just amazing .... Thank You sir this amazing series
@secondarypemail7181
@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
@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.
@harshitagnihotri4018
@harshitagnihotri4018 2 жыл бұрын
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
@edwardsnowden8749 Жыл бұрын
Please bring some long-video format content for segment trees🙏🙏🙏
@JayShankarpure
@JayShankarpure 2 жыл бұрын
Thanks for this amazing lecture series sir .
@Rohit_Gunwal
@Rohit_Gunwal 27 күн бұрын
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?
@deepakantoj432
@deepakantoj432 2 жыл бұрын
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
@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?
@mjustboring
@mjustboring 2 жыл бұрын
Combination 2 can be optimized... Here is how a[]
@mjustboring
@mjustboring 2 жыл бұрын
@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...
@AnkitJosh
@AnkitJosh 2 жыл бұрын
great explanation.
@aayuushh19
@aayuushh19 2 жыл бұрын
Problem 2 is damn hard!
@aniketpriyadarshi2801
@aniketpriyadarshi2801 Жыл бұрын
You are a very good teacher.
@charan775
@charan775 4 ай бұрын
problem 3 is definitely a difficult one. If you think in terms of recursion, it will be easier to get recurrence relation
@RudraSingh-pb5ls
@RudraSingh-pb5ls 2 жыл бұрын
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 ?
@yaswanthmitta8983
@yaswanthmitta8983 7 ай бұрын
x is index not value
@SahilSangwan-z5f
@SahilSangwan-z5f Ай бұрын
this approach in coin combinations 2 is giving rte constraints are high
@nsmworldentertainment4687
@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)
@gyanendrasaurav877
@gyanendrasaurav877 9 ай бұрын
the first question can be solved by 1d dp itself
@digitalgandu1511
@digitalgandu1511 8 ай бұрын
very well explained, thankyou.
@nithishkumar4699
@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
@SachinSingh-id8mf Жыл бұрын
use int instead of long long
@shitposting2234
@shitposting2234 8 ай бұрын
space optimise it
@rishav144
@rishav144 2 жыл бұрын
thanks a lot for this series ....Very well explained
@RudraSingh-pb5ls
@RudraSingh-pb5ls 2 жыл бұрын
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
@aniketpriyadarshi2801 Жыл бұрын
@@RudraSingh-pb5ls 1e8 would pass in one second.
@sakshamsengar9798
@sakshamsengar9798 2 жыл бұрын
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.s7937
@dharsan.s7937 2 жыл бұрын
Its a fucking goat outside [if u know u know ]
@sunnyrawat931
@sunnyrawat931 2 жыл бұрын
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
@farj3946 Жыл бұрын
I am not able to code homework problem 3. can anyone help me
@harshprajapati2729
@harshprajapati2729 2 жыл бұрын
last Question OP!!
@taniabanerjee4229
@taniabanerjee4229 2 жыл бұрын
thanks a lot🙂
@abhijeetfasate6131
@abhijeetfasate6131 Жыл бұрын
When will tle eliminators 7 start?
@iitianabhinandanpandey18
@iitianabhinandanpandey18 Ай бұрын
💛
@fashionvella730
@fashionvella730 Жыл бұрын
dp[i][k]= no of ways to make money k by using i no of coins is it not making more sense
@md.shazidalhasan6726
@md.shazidalhasan6726 4 ай бұрын
for me base case the is the most difficult
@deepnarayanpatra7300
@deepnarayanpatra7300 2 жыл бұрын
What's that application on the left side of ZOOM in the dock menu 🙂🥲 Please anyone tell 😐🙏
@rishabh507
@rishabh507 2 жыл бұрын
OBS studio
@JayShankarpure
@JayShankarpure 2 жыл бұрын
Android Studio i guess
@ankitghosh9873
@ankitghosh9873 2 жыл бұрын
Awesome❤❤ also why don't u change the pen
@PriyanshAgarwal
@PriyanshAgarwal 2 жыл бұрын
I have ordered an iPad. But that will arrive in a week so no pen changes in this bootcamp at least.
@RudraSingh-pb5ls
@RudraSingh-pb5ls 2 жыл бұрын
@@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
@daveloperkrishana7559 Жыл бұрын
LOVELY 💖💖 never learned like this how to think dp everywhere on youtube is just memorization of dp problems
@SurajGaud
@SurajGaud 2 жыл бұрын
Thanks bhaiya!!
@sahilanand30
@sahilanand30 2 жыл бұрын
🔥
@ekanshgupta2930
@ekanshgupta2930 2 жыл бұрын
can we use maps in question 2
@raghavnandwana3646
@raghavnandwana3646 Жыл бұрын
can someone provide the code for coin combinations 2 please in cpp
@farj3946
@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_ayandutta48
@cse_33_ayandutta48 2 жыл бұрын
Cat and mouse leetcode wala karwa do please
@aniruddhadas1651
@aniruddhadas1651 2 жыл бұрын
👍♥️👍
@abhishekranjan1094
@abhishekranjan1094 2 жыл бұрын
Priyansh why all kickstart coder solve problem in C++... I want kickstart solutions in java??? please reply me 🙏🙏🙄🙄😓
@uptonogood300
@uptonogood300 2 жыл бұрын
because java is trash for cp
@niteshsaxena03
@niteshsaxena03 8 ай бұрын
because C++ is best language for CP as it is faster
@chakshuverma8176
@chakshuverma8176 2 жыл бұрын
is it just me or the lecture 2 homwork questions were actually hard? 😔😔
@PriyanshAgarwal
@PriyanshAgarwal 2 жыл бұрын
They were hard Yes. But watch lecture 3, I have covered all of them.
@harmitchhabra989
@harmitchhabra989 2 жыл бұрын
Yeeeee
@SouravKumar-rg4yj
@SouravKumar-rg4yj 2 жыл бұрын
💘💘💘🔥
@zasqqa6060
@zasqqa6060 2 жыл бұрын
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
@ajitkumarsingh871 Жыл бұрын
Sorry but I think he was here with intent of teaching dp concepts not how to code dp problems
@nsmworldentertainment4687
@nsmworldentertainment4687 Жыл бұрын
can someone send code for loop for ques 1 using the same logic given in the video?
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Nothing Can Stop you from Competitive Programming After This!!!
16:29
Priyansh Agarwal
Рет қаралды 78 М.
Build ANYTHING With AI Agents For FREE! (DeepSeek-R1 Beats ChatGPT)
21:43
The Stress is Unbearable || Keymer vs Praggnanandhaa || Tata Steel (2025)
13:53
agadmator's Chess Channel
Рет қаралды 7 М.
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 253 М.
DEEPSEEK Vs CHATGPT There Is A  Clear Winner !!
15:53
Rick Aqua
Рет қаралды 18 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН