Generate unique permutations with duplicates

Quick Overview

This question evaluates a candidate's understanding of permutation generation and duplicate handling within algorithm design, testing combinatorial reasoning, correctness proofs, and time/space complexity analysis.

Generate unique permutations with duplicates

Company: Meta

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Given an array of integers that may contain duplicates, generate all unique permutations. Ensure no duplicate permutations are returned even if some values occur more than twice. Describe your algorithm (e.g., backtracking with frequency counts), prove correctness, and analyze time and space complexity.

Overview: This question evaluates a candidate's understanding of permutation generation and duplicate handling within algorithm design, testing combinatorial reasoning, correctness proofs, and time/space complexity analysis.

Meta logo
Meta
Sep 6, 2025
mediumMachine Learning EngineerOnsiteCoding & Algorithms
10
0

Given an array of integers that may contain duplicates, generate all unique permutations. Ensure no duplicate permutations are returned even if some values occur more than twice. Describe your algorithm (e.g., backtracking with frequency counts), prove correctness, and analyze time and space complexity.