Permutations | LeetCode 46 | C++ solution

preview_player
Показать описание

**** Best Books For Data Structures & Algorithms for Interviews:**********
*****************************************************************************

LeetCode 46 | Permutations
Facebook Coding Interview question,
google coding interview question,
leetcode,
Permutations,
Permutations c++,

#Facebook #CodingInterview #LeetCode #Google #Permutations #Amazon
Рекомендации по теме
Комментарии
Автор

Python Code with exact same logic (line by line):
def permute(self, nums: List[int]) -> List[List[int]]:
if len(nums) <= 1:
return [nums]

result = []
for i in range(len(nums)):
v = nums[0:i] + nums[i+1:]
res = self.permute(v);

for j in range(len(res)):
_v = res[j];
_v = [nums[i]] + _v
result.append(_v);

return result;

KnowledgeCenter
Автор

sir you are very good at explaining the algorithm

bandusakhare
Автор

This was a great explanation! Thank you so much.

shubhamomprakashpatil
Автор

Sir, what's the meaning of the line
vector <int> _v = res[j];

kausikmahata
Автор

Very nice, thanks. Just one question which software you used to be able to write so freely?

singarajusreedhar
Автор

Sir, can you please tell what is the time and space complexity of the problem.

abhishekks
Автор

Nice explanation time complexity should be o(n*n!)
and the space complexity is o(n)
correct me if I am wrong??

paragroy
Автор

Sir can you explain minimum height trees question from leetcode

swarajpatel
Автор

Well explained sir, can u make short tutorials on Java collections and Generic function? Will be helpful for all beginners.

arudhranarasimhan