import itertools as it
class Solution(object):
def combinationSum3(self, k, n):
"""
:type k: int
:type n: int
:rtype: List[List[int]]
"""
return list(it.ifilter(lambda x: sum(x) == n, list(it.combinations(range(1, 10), k))))
Download Combination Sum III.pyLeetcode 216 Combination Sum III problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.
Feedback is the most important part of any website.
If you have any query, suggestion or feedback, Please feel free to contact us.