How can we assume input doesn't rake duplicates?


#1

They should have mentioned array contains distinct numbers


#2

Its mentioned in the note:

NOTE

  • No two entries in the permutation sequence should be the same.
  • For the purpose of this problem, assume that all the numbers in the collection are unique.

#3

set<vector> s;
for(int i=0; i<result.size(); i++){
s.insert(result[i]);
}
result.clear();

for(auto it=s.begin(); it!=s.end(); it++){
    result.push_back(*it);
}

You can do this to get rid of the problem! Very simple and naive approach.