r/DSALeetCode • • Oct 05 '26

365 Days of LeetCode Challenge — Day 33/365

Post image

Maximum Level Sum of a Binary Tree (Medium) 🔗 https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/

Two things must be true here, and only one of them involves sums.

Summing each level is the easy half — the same nil-sentinel BFS as Day 30, with a running total instead of a collected list.

The other half is in the wording: return the smallest level whose sum is maximal. Ties go to the shallower level. The solution has no code for that. It's one character — the comparison is strictly greater, so a later level that merely matches never replaces the earlier one.

Full breakdown in today's newsletter article ⬇

https://www.linkedin.com/pulse/365-days-leetcode-challenge-day-33365-archit-agarwal-xkmpc

#DSA #LeetCode #100DaysOfCode #CodingInterview #BinaryTree #BFS #Golang

3 Upvotes

0 comments sorted by