Leetcode 1448 Count Good Nodes in Binary Tree | Coding Decoded SDE preparation Sheet

preview_player
Показать описание
Here is the solution to " Count Good Nodes in Binary Tree" leetcode question. Hope you have a great time going through it.

Check this out 🔽🔽🔽🔽

🔴 Connect with me here:

🔥🔥🔥🔥👇👇👇 For discussion/feedback/humour/doubts/new openings

🔥🔥🔥🔥👇👇👇 For discussion/feedback/humour/doubts/new openings

🔴 Checkout the series: 🔥🔥🔥

🔥🔥🔥 Leetcode Monthly Contest Playlist

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

Thanks to you sir, for teaching us the power of consistency.

denzilsamuel
Автор

I think we can remove the left and right null checks to make the code more concise. I think programming nowadays is all about writing concise code.

private void goodNodes(TreeNode root, int val) {
if(root==null)
return;
if(root.val>=val)
count++;
val = Math.max(val, root.val);
goodNodes(root.left, val);
goodNodes(root.right, val);

}

tanson
Автор

Sir❤️ please make video on
BLOCKCHAIN DEVLOPMENT &it's FUTURE

Avinash
Автор

bhaiya DP me "top down with memorization" approach se batane se kam chal jata h kya ya phir interviewer ko "bottom up iterative" bhi chahiye hota h

AmanSharma-vbjl
Автор

hi everyone, back from work!!! NOW it's leetcode time XD

shrimpo
Автор

Mind showing 1820 problem on leetcode graphs. Thanks

StellasAdi
Автор

I wasted 40 mins on this. it was too easy after I saw your explanation.

Vishal-joshi
Автор

Out of interest, what sort of soft are you hoping to produce?

dreamcreations
welcome to shbcf.ru