Pergunta de entrevista da empresa Microsoft

Given an array of distinct integers. Print all possible permutations of that array. Example: [1,2,3] Answer : [1,2,3] ; [1,3,2] ; [2,3,1] ; [2,1,3] ; [3,1,2] ; [3,2,1]

Resposta da entrevista

Sigiloso

26 de out. de 2015

There is N! (N, the size of the array) possibilities and you can resolve this problem with recursion. (Same kind of question in Cracking the Coding Interview)