Getiing TLE in 1 testcase

@aiman.mumtaz
You have to modify your code in such a way, that you don’t end producing any duplicates.
This trick helps in achieving that

if (a[i] != a[j] or i == j) {
		swap(a[i], a[j]);
		permute(a, i + 1, n, s);
	} 

why is the i==j condition used??

to consider the case when a[i]==a[j] only once.

What will be the case when i == j?

to take into the account the first occurence.

Is using vector better than using set?

If yes, then how? Please Explain

Vector and set both are different and have different uses. There is no clear cut answer, which one is better.

So I can use both for this problem?

Yes, but using set would be an overkill, since we are not producing duplicates

actually we are producing duplicates with 1 1 3 as input

Please refer to the code I mentioned earlier, it is not producing any duplicates… Please check