+ 4
Not getting all permutations in my code....
Please help me find my mistakes 🙏 https://code.sololearn.com/ca17A25a1717/?ref=app
10 odpowiedzi
+ 4
Instead of pushing full swapped s into recursion, put only a sliced tail into the the recursion.
For inserting into Set, you only need to insert under the condition index == n at beginning of soln() code block.
+ 2
ChillPill ty for replying and for ur suggestions .....
I knew about the function next_permuation() it's just that I'm still in learning phase so don't want to use built-in functions rather I would try to code them up
And I couldn't use auto feature because I was coding in dev- c++ which was working in c++98 mode .... XD
Aggghh I guess I should have changed some stuff before posting the code but still ty for everything
+ 2
I got my mistake......
While again calling the soln function I should have used index+1 as a parameter instead of i +1 ......because index is responsible for slicing I is for swapping elements
+ 1
👍
0
Gordon I tried ur soln but still no luck......
I believe u meant this
https://code.sololearn.com/cVAzPJdl4lAh/?ref=app
0
Gordon ty for replying..... I forgot to mention that earlier.....sry