educative.io

Permutation with duplicates

How would we permute with duplicates? Any logic similar to duplicate subsets?

6 Likes

It seems like this pattern falls apart when trying to create permutations with duplicates. I keep getting duplicate permutations when I try using the approach described here.

I think the understanding of the pattern is incomplete unless permutation with duplicates is added to this topic. Till now it seems to have been more of a greedy approach rather than a specific problematic pattern

Yeah, they should give logic for permutation with duplicates.

@Design_Gurus Can you please add this?

3 Likes

The pattern is great but without Permutation with duplicate there are other questions where this pattern can not be used. For eg: combinations sum with uniqueness. I use this pattern with slight modification but its too slow so we def need pattern with duplicates