Base case problem

I am unable to assume the base case.
please help

hi @tusharbhardwaj127 did you figure out the recurrance relation? Once you do that its quite easy to figure out the base case.

yes the recurence relation was f(n-1) +f(n-2)
I considered the base case as
if(n==0 or n==1) return 1
if(n==2) return 3
it didn’t work

hi @tusharbhardwaj127
when n == 1
possible strings are
0, 1
so the answer should be 2

hey.
so both 0 and 1 will be considered as a good subarray?

@tusharbhardwaj127 both of them satisfy the given condition, why should they not be considered?

ok, I got it.
Thanks

1 Like

@tusharbhardwaj127 dont forget to mark your doubt as resolved!