i think base case here could be if(N<=1){
return 1;
}
is this correct?
Optimal binary string recursion
sir said recurrence relation is f(N)=f(N-1)+f(N-2) but it is giving ans 3 for N=3 whereas it should be 5?
one thing i missed
for n=1 answer should be 2 right?
because we can either have 0 or 1.
so base case should be
if n==0
return 1;
if n==1
return 2
for f(3)=f(2)+f(1) -> ( f(1) + f(0) )+ f(1)
-> 2 + 1 +2=> 5
@aman212yadav I am little confused in that part in every case when we have 0 then there is 1 ways always in the friends party problems and n all ?