Hello everyone.Please help me in this question.I tried implementing some sort of recursive solution.One like maze solving.I am fairly new to recursion and badly trapped in this one.Help me.My solution run endlessly.Here is what I did.Please improve my solution.
Don't go with a way that's not true, this is going to cost alot of time so you can keep track of the index of the original string, so the function will look like:
And when you want to go to for example
(x+1, y+1)
you should check this:And the same for the
3
remaining calls.Base case:
(i == final.size())
Thanks a lot :) Can you tweak my code little bit and make it working...because that will clear the things even better.
If s is global the s.size() == final.size() will follow only once. make s an argument of the function and also you should check the function for every position of the matrix. code. ( why is n 8 instead of 5?)