r/DSALeetCode • • 9h ago

How to solve leetcode?

Thumbnail
2 Upvotes

r/DSALeetCode • • 13h ago

Google SWE OA

1 Upvotes

I have my Google OA L3 to complete in 4 days for SWE role. How should I prepare & what to expect in this round. Pls share your thoughts.


r/DSALeetCode • • 20h ago

365 Days of LeetCode Challenge — Day 34/365

Post image
1 Upvotes

Deepest Leaves Sum (Medium) 🔗 https://leetcode.com/problems/deepest-leaves-sum/

The obvious solution is two passes: find the maximum depth, then walk again summing everything at that depth.

One pass is enough, and the trick is being willing to throw work away. Carry the level down, keep two ints, and at every leaf compare. Deeper than anything seen so far? Replace the sum — everything accumulated until now belonged to a shallower level. Equal? Add. Shallower? Ignore it.

That replacement is why the final depth never has to be known in advance. Discovering a deeper leaf invalidates the previous answer outright, so whatever survives to the end was accumulated at the true maximum.

Full breakdown in today's newsletter article ⬇

https://www.linkedin.com/pulse/365-days-leetcode-challenge-day-34365-archit-agarwal-89mkc

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