Tricky permutations problem

last test case giving tle
code-link

the problem is u are checking a permutation with the whole vector
instead do like that
push then into the vector
sort the vector
and then all the same string move together then u can check if v[i] != v[i+1] then cout<<v[i]

1 Like