N-th Tribonacci Number - Leetcode 1137

preview_player
Показать описание

Solving the Nth tribonacci problem, today's daily leetcode problem, on January 29th.

0:00 - Read the problem
0:30 - Drawing Explanation
1:55 - Coding Explanation

leetcode 1137

#neetcode #leetcode #python
Рекомендации по теме
Комментарии
Автор

These daily problems help a lot! Thank you

MP-nyep
Автор

Would love some feedback on my solution:

h = [0, 1, 1]
def trib(lis: list, num: int, ctr: int):
if num<3:
return h[num]

if ctr < num:
lis.append(lis[-1] + lis[-2] + lis[-3])
trib(lis, num, ctr+1)

return lis[num]

print(trib(h, 3, 0))

kinanradaideh
Автор

Good stuff. Neetcode could you make a video about python decorating annotations on leetcode and other coding tricks you've seen on leetcode so far?

pauljones
Автор

Please continue with more easy problems

girishnakate
Автор

Thanks for the video! I have my virtual onsite tomorrow ^^

milktea
Автор

wow - isn't this tabulation - dynamic programming approach?

servantofthelord
Автор

Hello NC, can you share your Leetcode profile link to us, just curious .

clandestina_genz