Question DSA-REC-0020
HardWhat is the time complexity of generating all permutations of n distinct elements?
- A.
O(n²)
- B.
O(n × n!)
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Recursion and Backtracking question
What is the time complexity of generating all permutations of n distinct elements?
O(n²)
O(n × n!)
Sign up free to see the answer and a step-by-step explanation.
O(n!) only, regardless of output
O(2ⁿ)