Class assignment question

check my code, its giving time limit error

hi sanchit
dot use a string use a char array in string u have to use the erase fun to remove but in char array index autonmatically backtrack

Also after this it will gave tle as code complexity is more than 2^n
and according to xonstraint it will exceed time

try to find out a patter between the ans using some small cases

explain that string and char array thing again, why did u say not to use string here?

is it giving wrong answer when i use string here?

U r finding all possibilities in string when u backtrack u need to erase that position but in char array u maintain a index variable so update that index value

i think in my my approach(not correct) i did not backtrack so i used string but now ill try to find some other way of doing it then ill use char array

Yes
Whenever u do type type of problem better use array