Question bank › Recursion
Dsa Recursion Medium

Find All Permutations

Write a function to generate all the unique permutations of a given list of integers. The output should show each permutation on a new line in lexicographic order. For input [1, 2, 1], the output should include [1, 1, 2], [1, 2, 1], and [2, 1, 1]. Read the input list from standard input and output the permutations. Example Input: 1 2 1 Example Output: 1 1 2 1 2 1 2 1 1

Key concepts

recursionpermutationsbacktracking

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.