Binary Tree Max Path Sum (LeetCode Day 29)

preview_player
Показать описание
Given a binary tree with values in nodes, find a path with the maximum sum of values. This coding interview problem is quite similar to other tree problems like "find height" or subtrees or any kind of dp on trees - it's just about thinking what should be returned by DFS.

Subscribe for more educational videos on algorithms, coding interviews and competitive programming.

#Coding #Programming
Рекомендации по теме
Комментарии
Автор

With due respect I just say your programs are very clear in concept and simple to implement. It naturally feels that it's so simple to understand the logic and implement it. Thanks for do it so effortlessly.

coderaspirant
Автор

Thank you this was clear and concise. We love your drawings.

BedoEbied
Автор

This problem is something similar to leetcode day 11 problem about tree's diameter, wich was quite hard for me, but after your explanations I was able to solve this by my own, so thx for you work Errichto! :)

mr-m
Автор

What so great explanation, including the wrong answer, you are a grand master!

eloyhz
Автор

I was signed out while watching this.
Signed in again just to like it. :)

Thankyou Errichto! /\
I found this difficult tbh and your solution was extremely elegant.

Will you be doing the May challenge as well?

prashanthvaidya
Автор

Thanks for explaining so well.
The last part was similar to Kadane's algo.

vivekdubey
Автор

Since I've just watched your DP tutorials and this, is the approach straightforward for these problems?
Find number of paths in the tree where their path sum (by nodes' value) is:
- at most K
- equal K
- at least K.

nhantran
Автор

Hi errichto, I can't tackle graph colouring problem from Atcoder ABC. Give some advice to how I tackle problems related to graphs.

vishalchaurasia
Автор

Can you do a tutorial for Hash Tables and Maps? That is another harder concept to grasp. Love your tutorials. Thank you.

zihanbayeed
Автор

hy Erritcho wich should i learn after c++: java or python? Thanks for answering!

mogovanjonathan
Автор

beautiful perfect explaination sir. Thank you.

mohitsinha
Автор

Thanks a ton!!!! i was struggling with this

franky
Автор

Hi errichto, how can I become that good at programming like you and how I can get all that knowledge that you have in c++ about language and problem solving, I'm new in this world. I will thankful if you help me, with books names and stuff like that...
PD: I don't speak english, then I apologize for my writting.

iasith
Автор

Please make some tutorial video about Graph theory:)

serserserserserserser
Автор

*Errichto please conduct some contest on hackerrank for your subscribers please at least monthly once*

Vijay-phgb
Автор

What the teddy is looking at? Is he sad?

SaurabhYadav-wjzm
Автор

where is your silver tick from the youtube?

prakashshukla
Автор

Your videos have high ratio of likes to dislikes . Please continue making these kind of problem solving regularly. Thanks.

niebhasanneom
Автор

how does dfs return value matter as it is not updated .The value main function is returning is answer not return value of dfs

mohitsingh-nfvl
Автор

Did he just read, solved that question and explained it in under 9 minutes

god-speed