Master Data Structures & Algorithms For FREE at AlgoMap.io!
@ARkhan-xw8ud6 ай бұрын
I did not get it
@rhen46108 ай бұрын
my school told me it was gon be just some basic/fundamental coding problem, but then they threw this out there on the medium category of the challenge. Thanks tho!
@GregHogg8 ай бұрын
Haha I see! You're very welcome :P
@stanleyching1235 ай бұрын
Hey Greg, really cool solutions.. but I’m struggling with visualising the recursive backtrack algorithm and the tree. I think it will be helpful if you could run the code line by line in respect with the visual diagram and shows how it work
@ThoXuanLeАй бұрын
I think you also need to write on paper to understand deeper, that how I learn recursive.
@gamasterprochannel8566 ай бұрын
couldn't we start with 1 not 4 ?
@user-jm6gp2qc8x4 ай бұрын
Hey Gregg, I am following your vids a lot. I feel that this solution can be modified to be a bit more intuitive for audience
@nikunjdeeep4 ай бұрын
hey greg i enojoy learning from your videos but you could have solved this (1 to n) and not (n to 1) because visulizing first one for a new coder is easier i guess(atleast for me)
@bilalalfakih10173 ай бұрын
class Solution: def combine(self, n: int, k: int) -> List[List[int]]: result, sol = [], [] def backtrack(i): if len(sol) == k: result.append(sol[:]) return for num in range(i, n + 1): sol.append(num) backtrack(num+1) sol.pop() backtrack(1) return result