tag:blogger.com,1999:blog-3418265334198879901.post2352488635732262738..comments2023-06-10T14:12:41.433+05:30Comments on Coders Stop: Count the number of ways .Aviralhttp://www.blogger.com/profile/11920144614598355124noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-3418265334198879901.post-33081010503410166522011-01-30T15:11:25.929+05:302011-01-30T15:11:25.929+05:30It can be understood if u look at the problem as a...It can be understood if u look at the problem as a DP. Since u can give only 1 or 2 chocolates at a time so the number of ways can be computed based on the earlier computations. If<br />Number of ways of giving n chocolates = f(n)<br />So f(n) = f(n-1) + f(n-2) which is a Fibonacci series.<br /><br />RegardsAviralhttps://www.blogger.com/profile/11920144614598355124noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-69988482826085811562011-01-30T14:50:07.467+05:302011-01-30T14:50:07.467+05:30sir,
ek dum hit nahi howz it fibonacci
shashwat si...sir,<br />ek dum hit nahi howz it fibonacci<br />shashwat sinhaAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-55810190182885250672010-11-16T01:01:04.650+05:302010-11-16T01:01:04.650+05:30In simple terms.... it is a Fibonacci series :)In simple terms.... it is a Fibonacci series :)Aviralhttps://www.blogger.com/profile/11920144614598355124noreply@blogger.comtag:blogger.com,1999:blog-3418265334198879901.post-15325633990119276772010-11-11T18:20:04.044+05:302010-11-11T18:20:04.044+05:30int no_of_ways(int total_coins)
{
if(0==total_coin...int no_of_ways(int total_coins)<br />{<br />if(0==total_coins ||1==total_coins||2==total_coins) return total_coins;<br />return (no_of_ways(total_coins-1) + no_of_ways(total_coins-2) );<br />}Jayaprakash Sundararajhttps://www.blogger.com/profile/06882639916019574853noreply@blogger.com