Combination Sum - Recursive Backtracking - Leetcode 39

preview_player
Показать описание
Combination Sum - Recursive Backtracking - Leetcode 39

#coding #leetcode #programming #interview
Рекомендации по теме
Комментарии
Автор

is the time complexity for this O(2^n) ?

Gamerayoub.
Автор

or just use a bottom-up dp solution with a time complexity of O(n*target) where n is the length of the list and target is the sum

kevinshenshiqi
Автор

You can do it in O(n) time complexity. Storing the values in set and check for target - nums[i] in set

binbash
Автор

use two pointer pattern to solve this ...
for O(n)

Mukesh-bfxt
Автор

Why don’t these videos ever give a real example of how this is used

tonyc
Автор

These examples are so contrived. Do you pick a solution first, and then come up with some problem?

tazanteflight
Автор

Prefix sum or hashmap is best for this

SujanRai-fk
Автор

Все это конечно круто и прикольно, вот только скажите, хоть кто-то где-то в реальной жизни это использует ?

LocalhostTube
Автор

Just asking u guys. If you are under interview coding round would u know to use this algorithm?

彩色糖果-ii
Автор

This is boring, it is cooler if they only ask the number of possible combinations

jumpjump-ozpr
welcome to shbcf.ru