If the problem is greedy then always try proving your solution and trying out some random test cases before submitting your solution. It will always help.
For the 2nd problem, why should we fix last 3 to get a sequence? The last is fixed already as n. We only need to change the penultimate element to vary and generate different sequences. Or am I missing something here?
You are right. To generate a new element you need two elements. So if you fix the last two you will be able to generate a sequence. This is just a small implementation difference.
I found there was no meaning of writing min of 31ll just need to pass k - 2. We are writing min because k can be large but n only is allowing till 10 raise to 5 approx. Am i understanding it correctly?
Yes if we take the first 31 numbers of any Fibonacci series it will already pass the value of N so no use of taking any greater value that is why we are taking min.
@@cpwithcpp Sir can you please explain us the approach of editorial of problem C if you upsolve it later Please make a video on it It would help us a lot , a lot of us are completely unable to understand the approach provided in editorial
@@cpwithcpp yes posting your learnings from upsolving will be very helpful bcoz whatever concept you dont know surely we too dont know and we will also get to learn that. 🙌
Sir, How do we make observations like you did with 30 the problem was very easy if a person made this nice observation? The solution was screaming to my head but i though that it is O(n * k) so it wont work
Whenever you think of brute force. Try to find the maximum upper bound on the problem. Try to estimate the correct complexities and feel free to use the internet during contests. It is allowed to use any resource which was published before the start of the contest.
Keep uploading videos, Loving them !
Great explanation of B. Thanks.
Nice explaination bhaiya.
Ty
How do you build on so good logic that passes all the test cases , it happens always with me that basic given testcase passes but hidden always failed
If the problem is greedy then always try proving your solution and trying out some random test cases before submitting your solution. It will always help.
thx for the good explanation :) go on
For the 2nd problem, why should we fix last 3 to get a sequence? The last is fixed already as n. We only need to change the penultimate element to vary and generate different sequences. Or am I missing something here?
You are right. To generate a new element you need two elements. So if you fix the last two you will be able to generate a sequence.
This is just a small implementation difference.
@@cpwithcpp 👍 thanks for the solid explanations
@@aadhithyarp4879 th-cam.com/video/IdWDQCbKcic/w-d-xo.html easy solution
@@cpwithcppb
How you checked that sequence should contain exactly k terms?
its shown in the recursive function ... he assigned the parameter of position to (k - 2) and he make ans++ if pos = 1 only :)
th-cam.com/video/Z9PvfQLfS4c/w-d-xo.html easy solution
I found there was no meaning of writing min of 31ll just need to pass k - 2. We are writing min because k can be large but n only is allowing till 10 raise to 5 approx. Am i understanding it correctly?
Yes if we take the first 31 numbers of any Fibonacci series it will already pass the value of N so no use of taking any greater value that is why we are taking min.
Suggestion: post what u learnt from upsolving missed problems from contests.
I will try to update all the problems which I uplsolve after the contest in a youtube post.
@@cpwithcpp Sir can you please explain us the approach of editorial of problem C if you upsolve it later Please make a video on it It would help us a lot , a lot of us are completely unable to understand the approach provided in editorial
@@cpwithcpp yes posting your learnings from upsolving will be very helpful bcoz whatever concept you dont know surely we too dont know and we will also get to learn that. 🙌
any good source to learn dfs i genrally gets confused during where to add visited and apply dfs operations
Code N Code graph playlist is good you can watch from there. Many people also watch Striver's playlist so you can also check that out.
Sir, How do we make observations like you did with 30 the problem was very easy if a person made this nice observation? The solution was screaming to my head but i though that it is O(n * k) so it wont work
Whenever you think of brute force. Try to find the maximum upper bound on the problem. Try to estimate the correct complexities and feel free to use the internet during contests. It is allowed to use any resource which was published before the start of the contest.
@@cpwithcpp Sir♥️
i need 3rd
I think the test cases of div 2 b was weak , and it was like if u only know then u can only solve it
I saw some people got FST.
@@cpwithcppfst ?🙄