problem
solution
option 1 - dfs
if(find(path.begin(), path.end(), nums[i])!=path.end()) continue; 可以用一組陣列代替if(visited[i] = true) conitnue;
1  | class Solution {  | 
1  | class Solution {  | 
option 2 - math
1  | 
  | 
analysis
- time complexity 
O(n)n 節點個數 - space complexity 
O(n)n 節點個數