problem
給定k、n 找出所有和為n,長度為k的有效組合,其元素只能落在1到9區間,且數字必須唯一,不能重複取。
sloution
1 | class Solution { |
analysis
- time complexity
O(len(nums)^M), M if theight of our recursive - space complexity
L, L is the longest combination
給定k、n 找出所有和為n,長度為k的有效組合,其元素只能落在1到9區間,且數字必須唯一,不能重複取。
1 | class Solution { |
O(len(nums)^M), M if theight of our recursiveL , L is the longest combination