Start and Proceed

Please help me how to start this question and how to go about it.

Hi ,
so u`ll have to try some working out for small test cases
n =1 u get answer 2
n = 2 u get 3
n = 3 u get 5 ( 101 111 010 110 011 )
n = 4 u get 8

we see some pattern similar to fibonnaci series f[n] = f[n-1]+ f[n-2]

So how does backtracking come into play? @chhavibansal

nowhere.
just a simple dp question

Okay so it was just a fake :smile:
It is a challenge under the backtracking section so I was wondering.
Anyways thanks

1 Like

Hey @chhavibansal ! Not a single test case being passed. Please help!

cout << “#” << i++ << " : " << assignment(n+2) << endl;
there was error in the way you were printing the o/p
updated code

Why did this i come here?
I still didn’t get the output format :frowning_face:

it like
i_th test case # : functionVALUE() newline
i+1_th testcase #: functionValue() newline

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.