The general rule is to "start solving problems at the easiest part" ---> "fun(1)" then you gradualy continue towards the surrounding parts.
@yogitshankar63482 жыл бұрын
thank you
@shubhamjain1543 жыл бұрын
When examiner don't want you to pass...😂😂
@irfanahmad-uy6dx Жыл бұрын
Exactly 😂
@veerrajusingamsetti3524 жыл бұрын
i understand this problem very easily. you have divided bigger problem into sub problems which made easy to understand you are really great sir thank you
@krishwanthkishore8299 Жыл бұрын
Yo i have a doubt , how can the function goes recursion again here if it's not called separately 😅
@avirsingh72516 жыл бұрын
Best method to solve this question
@umairalvi73825 жыл бұрын
What a brilliant question with an excellent explanation.!!!!
@skyvoz4 жыл бұрын
There was so much fun. Maja aa gaya 😂
@afsarsayyed4980 Жыл бұрын
Confused unga bunga 😂
@ahmed_raaphat3 жыл бұрын
Your approach for solving the problem is awesome, thanks for sharing this.
@mdadnan79852 жыл бұрын
I love u , man!! You r such a genius person. Lots of love from Bangladesh.❤❤
@kostavsheoran15305 жыл бұрын
that was a lenthy one , how much time it is given to solve a question in GATE!
@urstrulysandeep7209 Жыл бұрын
@herohera3497 Жыл бұрын
@@urstrulysandeep7209 lol
@peasant12345 Жыл бұрын
@@urstrulysandeep7209 wtf!
@Codality4 жыл бұрын
Thx a lot, it was such a perfect example
@johnychinese Жыл бұрын
The left hand side of the equation is already what is fed into the x in the first iteration. So in the second iteration all of that first iteration solution becomes your new x
@omgaikwad05103 жыл бұрын
This was a unique question and you made it very interesting to understand.
@rajdeepmajumder46976 жыл бұрын
keep this up we need more videos related to GATE
@mipa38682 жыл бұрын
thanks sir for amazing content.. sir doubt at 3:40...sir when we are calculating fun(5)...and we encounter fun(1) and fun(4) in the first iteration ..shouldn't the control go to fun(1) and then fun(4)....why are we jumping to second iteration directly?
@msgudaduramath49802 жыл бұрын
Yes I am also can't understand this why we jump to again for loop before calling the function
@krishwanthkishore8299 Жыл бұрын
@@msgudaduramath4980yo it actually goes based on the for loop , when k=1 , we find x value for k=1 and let's take this x as x¹ and since there's a ' return ' statement , it return ' x¹ ' value to the next iteration aka when k=2 and x=x+f(k) +f(n-k) and here the value of x in the left hand side is what we found in the previous iteration (x¹) and instead of applying directly x¹ here we substitute the value of x¹
@msgudaduramath4980 Жыл бұрын
@@krishwanthkishore8299tq bro
@bhavintrivedi61944 жыл бұрын
you are a true magician.
@pranaypraneeth17405 жыл бұрын
Why is that k
@zitrakzsingh72955 жыл бұрын
it is taken as 1 to n-1 ie k
@dipeshranadipeshrana881 Жыл бұрын
Many people are confused why we don't add 1 for 2nd, 3rd and 4th iteration of for loop. Why we add 1 in function fun(5) only.
@johnychinese Жыл бұрын
The left hand side of the equation is already what is fed into the x in the first iteration. So in the second iteration all of that first iteration solution becomes your new x
@payalsagar18085 жыл бұрын
even with the trick the question takes more than 2 mints😹
@Chinjukr_aac6 жыл бұрын
Lectures are good..pls upload structure and union
@prakasharja5696 жыл бұрын
can you explain about cmos using all logic gates in one video it is very useful
@godowntown24563 жыл бұрын
Enjoy when you read this cause I rarely comment on any video. But Neso, you are a channel of perfection.I am a perfectionist and I know one when I see one. You should post a documentry in your channel about Neso and PEOPLE(or person) behind it. I am sure all viewers will agree on this.
@GSN-TG2 ай бұрын
why dont uou use {} brackets after if and for loop to make it easy to understand what's inside and what not!
@gitanjalikumari92624 жыл бұрын
Nice approach to solve this problems.
@lordstinson80954 жыл бұрын
What will be the time complexity of this fun(n) ?
@shodipojmarydee3853 Жыл бұрын
n
@congomigue90726 ай бұрын
Its exponential that is O(2^n)
@samsons82793 жыл бұрын
Time consuming question ; but easy if solved *_patiently_* - which we lack during exams.... 😪😅😅😨
@yavuzer57655 жыл бұрын
7:34 "infantry"
@Aabara_ka_dabara Жыл бұрын
nice explanation.... easy to understand..
@DJAKASHOFFICIAL998 Жыл бұрын
Very Good question
@harshitsingh4806 жыл бұрын
I think there is error in question it should be k++. (as if it is ++k pre increment operatorthen in the first iteration itself it would be x=1+fun(2 )+fun(3)) . if i am wrong please point me out by making video.please help neso academy and keep uo good work you are doing
@nedstark97345 жыл бұрын
No. in for loop increment/decrement executed at the end of iteration so it doesn't matter whether you write ++k or k++
@ayushrawat79512 жыл бұрын
There is no difference in ++I or I++ in case of looping.
@palestinianlivesmatter7861 Жыл бұрын
omg yes i thought of the same thing there for i couldny solve it
@universalcosmologist3675 Жыл бұрын
this question is so much fun
@nik-ys8ki4 жыл бұрын
nicely done, excellent job......
@truth-12345. Жыл бұрын
So you really need to review your mathematical skills in order to get around with this. Thankfully this tutorial exist.
@badxcode4 жыл бұрын
when you entered the for loop for second time in 3:28 with value k = 2, why din you add 1 again. fun(5) = x + fun(1) * fun (4) {for k = 1} next when k = 2 then it was supposed to be fun(5) = x + fun(1) * fun(4) + fun(2) * fun (3) ..and so on {k = 2} why you din add (x) once again??
@manasgupta50044 жыл бұрын
No as because value of x changes to last one after each iteration so actually we just need to add new one to the last one not point of adding whole
@badxcode4 жыл бұрын
@@manasgupta5004 thanks for you concern. Tho I was able to figure it out then.
@manasgupta50044 жыл бұрын
@@badxcode no problem bro ! Have A great day☺️
@VishalKumar-uu3xm2 жыл бұрын
great explaination sir
@ashishsingh70564 жыл бұрын
both hard but awesome
@sammilyeen18483 жыл бұрын
omg i am surprise i am able to solve this ques correctly
@sounavapal7626 жыл бұрын
I had a lot of fun😃
@mohdezazulhaq16543 жыл бұрын
Good question amazing
@cococookie675 жыл бұрын
Sir, can u please explain to me why you weren't adding 1 for each iteration? We had x=x+fun(k)*fun(n-k) but u only added that 1 for x once, for the first iteration. I don;t understand why.
@vivekojha48075 жыл бұрын
It's because x+fun(k)*fun(n-k) becomes your new value of x. The new value of x gets added to fun(k)*fun(n-k).
@mariappanduraisamy8623 жыл бұрын
I too have this doubt ,can anyone explain me?
@seven78463 жыл бұрын
I don't know that is the right explantaion but here is what i think about that:- When the loop is working then only this statement ( x=x+fun(k)*fun(n-k)) is execute so, (return x) statement won't execute till loop doesn't finish it's working ,so when when the working of loop is finish the we have this statement (fun(3)= x =1+fun(1)*fun(2)+ fun(2)*fun(1) ) this is the only equation left when command goes to return x so that's why we added 1 for x once. (sorry for bad grammer), i hope you understand it.
@tomigoi3 ай бұрын
The absolute KEY of this problem is not to add 1 after every iteration of the for loop. So easy to miss.
@dakshpatel1769 Жыл бұрын
What a question 🫡
@nextrealm Жыл бұрын
thanks sir
@soumyaranjanpadihari9696 Жыл бұрын
as there is ++k and as it is a preincrement operator, will not k be preinremented before using it in the loop?
@dakshpatel1769 Жыл бұрын
When condition is true, then code written inside loop will executed first and then after increment will happen... Here pre increment doesn't matter because eventually it will be incremented..
@sr-sunny-raj4 жыл бұрын
@Neso Academy , Sir their is ++k in the for loop which is pre increment so in the first iteration it would be x = x + fun(2) * fun(3), but you are doing something else. please sir kindly solve my issue.
@rushikothari12614 жыл бұрын
Steps of For Loop: 1.Initialization 2.Check condition 3.Execute Body Operation 4. Increment . Therefore For first iteration, x= x+fun(1)+fun(4) After Completion of this Body expression K is incremented..
@khaledabdlhamid56924 жыл бұрын
@@rushikothari1261 so you're saying that there is no difference between ++k and k++ in for loop?
@rushikothari12614 жыл бұрын
@@khaledabdlhamid5692 yes,kindof
@nishchaysingh76014 жыл бұрын
i think he must have assumed it as k++...because before diving into his solution i tried to solve it by myself
@nishchaysingh76014 жыл бұрын
and the way u did it is correct
@true41894 жыл бұрын
Thank u
@devukun83582 жыл бұрын
When they say:" Programming is easy" is the greatest insult ever to mankind.
@mimSamad Жыл бұрын
im happy to find 51
@roshanmhatre88104 жыл бұрын
Why were u saying k
@yu_a_vi44274 жыл бұрын
He said the loop will ittrate for n-1 times which is true for (k= 1 ; k< n ;) You are confused about if the loop will ittrate for n times as if in for (k=0 ; k
@narendrajatav99695 жыл бұрын
Value of x is not being added back to x? elaborate?
@eftyshanabid65172 жыл бұрын
great
@Thegrand34122 жыл бұрын
elegant!!!!!!!
@Vaibhavpatil02014 жыл бұрын
Excellent Question But I got a lot of confusion
@andistheinforitbutso75132 жыл бұрын
Questions getting tougher and tougher but we will be continuously nagging till the tough Questions surrender with irritation
@harshitsingh4806 жыл бұрын
I am completely unable to understand the soln also that why you added fun 2 and fun 3 rather you should have written 1+fun(2)*fun(3) why you mussed out one for k=2?
@congomigue90726 ай бұрын
I guess am 5 years late, but the reason is that the '1' you are asking about has been added in those fun 2 and fun 3 on an individual level, like if you open up fun 2 and fun 3, you'll realize that 1 was taken care of if broken down, it contains the 1 you are worried about.
@MANYAKAPOOR-o8f Жыл бұрын
wont there be any difference of ++k or k++ ?? PLEASE DO EXPLAIN
@arpitkesarwani61236 жыл бұрын
Sir i think there should be k++ instead of ++k in for loop. Am i correct?
@arpitkesarwani61236 жыл бұрын
@@nesoacademy ok thank you sir
@pranaypraneeth17405 жыл бұрын
@@nesoacademy Why is that k
@duanedsilva5 жыл бұрын
@@pranaypraneeth1740 bcus it is k
@universalstarcpu95223 жыл бұрын
I don't know but I did the sm manner by pausing the video and I did it in 8 min It is too time taker prblm If we sit on this type of prblms in gate exam we get less marks as even if a small mistake in adding may result wrong ans
@the_ocean_eyes3 жыл бұрын
In 2nd iteration when we are calculating fun(4) i.e n=4 and k=2 ... So why are we not taking x= 1 + fun(1) + fun(4) + fun(2) + fun(4-2=2)???
@msgudaduramath49802 жыл бұрын
No here for n=4 ,for loop continues till k=3,after loop ends,so values k will be 1,2,3
@kaushalmittal32573 жыл бұрын
At 10:15 Victory:)
@henrypaul56763 жыл бұрын
What a mindfuck! Some Inception level shit.
@mohdaslamshah23455 жыл бұрын
Sir please upload video on data structure...........
@sayantanghosh67004 жыл бұрын
It's pre increment not post increment so , is there no difference???????
@interpreter0012 жыл бұрын
Why did you not consider ++k ?
@ruthviksaikalahastri7513 Жыл бұрын
Answer is (C) 51
@rohitupasani32399 ай бұрын
I didn't understand why you were jumping on the next iteration without calling by fun(k) and fun(n-k)?
@missionimpossible565710 ай бұрын
Hardest question I have seen so far🫡
@user-dj9zb3bs1b3 жыл бұрын
there are very dangerous fun 😂😂😂 be carefully. 👍
@damareswaramaddepalli97146 жыл бұрын
I think X value should be added second iteration 😇
@johnychinese Жыл бұрын
The left hand side of the equation is already what is fed into the x in the first iteration. So in the second iteration all of that first iteration solution becomes your new x
@abhishekmukherjee76733 жыл бұрын
#include int fun(int n) { int x=1,k; if(n==1) return x; for(k=1;k
@pradhanan94133 жыл бұрын
You've written return x inside the for loop. Take it outside
@aniketrohit72872 жыл бұрын
no you have not correctly write code my code gives output 51 #include int fun(int n){ int x=1,k; if(n==1) return x; for(k=1;k
@jagdeepsingh-tv4ty5 жыл бұрын
sir i think you forget to mention x+fun(2)*fun(3) [x in these cases] my computer executes the code and gives me 81 as answer
@Mets03115 жыл бұрын
You made a mistake. This program executes 51. The mistake you made was on " x = x + fun(k) * fun(n-k); " What you did was add the two recursive calls instead of multiplying. Which would have gave you 81.
@mrunalshende16634 жыл бұрын
my my the explanation is on top but the problem took itself like 4-5 minutes totally not worth if you see time
@shibambiswas Жыл бұрын
👍
@pratikagarwala29195 жыл бұрын
Bhai mai itna ganja marka bhi nahi soch sakta😂
@pookystudio67024 жыл бұрын
😁😁
@dsdcp4 жыл бұрын
why 1+fun(1)*fun(3)+fun(2)*fun(2)+fun(3)*fun(1) IS = 1+5+4+5 Cant understand
@eslamwaled492 Жыл бұрын
very hard
@bsaikumarreddy14136 жыл бұрын
Sir, please upload videos fast
@gauravsinghgaherwar65484 жыл бұрын
😀😀🙏
@abhishekthakur29334 жыл бұрын
Very difficult
@kavithapriyacj48684 жыл бұрын
😭😤
@cyethacksolutions67613 жыл бұрын
in order to visulise this Problem i Have Modified the program Little bit: #include int fun(int n ) { int x=1,k; if(n==1) return x; for(int k=1;k
@cyethacksolutions67613 жыл бұрын
also i follow different way to solve this problem: start evaluating the fun(5) to Fun(1) now start finding the values of Fun(1 to 4) , it repeat the last calculating value of fun(2)=1+fun(1)*fun(1), so fun(2)=2 similarly find fun(3) . I might sound like the same way he explain in video but, the method is different and lengthy, i make 2 time mistake while solving it by my own
@nihalpandey56754 жыл бұрын
Who did this at first shot
@TheFeralEngineer3 жыл бұрын
Recursion makes me dizzy ☹️
@kaushikipathak92584 жыл бұрын
matarani raksha krna... aise aise questions naa hi aaaye
@pookystudio67024 жыл бұрын
😁😁
@dipeshranadipeshrana881 Жыл бұрын
❤️❤️❤️❤️❤️
@shuvrobrothabiswas3122 Жыл бұрын
add is so much disturbing nesooo.....plz stop it...........