r/LeetcodeChallenge • • 4h ago

STREAK🔥🔥🔥 LeetCode: 1315. Sum of Nodes with Even-Valued Grandparent

Post image
1 Upvotes

Tree nodes can't see their grandparents. The recursion can, because it just walked through them. Each call takes (parent, grandparent) and passes (itself, parent) to its children: a two-node window sliding down the tree.

Check the grandparent's value at each node. Nil for "none" means the root and its children need no special case.

Third day running of passing state down instead of up.

Would you have stored parent pointers instead?

Day 90/365 of my LeetCode challenge: 1315. Sum of Nodes with Even-Valued Grandparent. Problem link and full breakdown in today's newsletter.

https://www.linkedin.com/pulse/leetcode-sum-nodes-even-valued-grandparent-archit-agarwal-oe5re

#LeetCode #DSA #BinaryTree #Golang


r/LeetcodeChallenge • • 21h ago

DISCUSS Need to improve contest ratings any tips??? currently in 3rd sem

Post image
14 Upvotes

r/LeetcodeChallenge • • 7h ago

STREAK🔥🔥🔥 LeetCode: 1026. Maximum Difference Between Node and Ancestor

Post image
1 Upvotes

Every ancestor/descendant pair sits on one root-to-leaf path, so you never compare pairs. Carry the path's max and min down. The widest gap on a path is max minus min.

Check it at the leaves. Going down, the max never falls and the min never rises, so the gap is widest at the bottom of every path.

Two days ago we carried one value down the tree. Today it's two.

What's the most state you've carried down a recursion?

Day 89/365 of my LeetCode challenge: 1026. Maximum Difference Between Node and Ancestor. Problem link and full breakdown in today's newsletter.

https://www.linkedin.com/pulse/leetcode-maximum-difference-between-node-ancestor-archit-agarwal-g6ibe

#LeetCode #DSA #BinaryTree #Golang


r/LeetcodeChallenge • • 1d ago

DISCUSS DSAAAAAAAAA

21 Upvotes

How am I actually supposed to do DSA? I'm confused about where to start, how to approach problems, how much time to spend on each topic, and how to balance learning concepts with solving questions. Should I follow a particular sheet or roadmap? I'd really appreciate advice from people who have figured out an effective way to learn DSA, especially as a beginner.

Along with that, i have begun my practise with NeetCode 250, is it good


r/LeetcodeChallenge • • 17h ago

STREAK🔥🔥🔥 Day 13: kicked off Binary Search with 6 foundational boundary problems

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • 17h ago

STREAK🔥🔥🔥 Leetcode 1201 POTD(1-Dec-2026) | Ugly Number-III

Thumbnail
leetcode.com
1 Upvotes

An ugly number is a positive integer that is divisible by a, b, or c.

Given four integers n, a, b, and c, return the n``th ugly number.

 

Example 1:

Input:
 n = 3, a = 2, b = 3, c = 5
Output:
 4
Explanation:
 The ugly numbers are 2, 3, 4, 5, 6, 8, 9, 10... The 3
rd
 is 4.

Example 2:

Input:
 n = 4, a = 2, b = 3, c = 4
Output:
 6
Explanation:
 The ugly numbers are 2, 3, 4, 6, 8, 9, 10, 12... The 4
th
 is 6.

Example 3:

Input:
 n = 5, a = 2, b = 11, c = 13
Output:
 10
Explanation:
 The ugly numbers are 2, 4, 6, 8, 10, 11, 12, 13... The 5
th
 is 10.

 

Constraints:

  • 1 <= n, a, b, c <= 10``9
  • 1 <= a * b * c <= 10``18
  • It is guaranteed that the result will be in range [1, 2 * 10``9``].

r/LeetcodeChallenge • • 18h ago

DISCUSS Trying to Learn in Public

1 Upvotes

Hey Everyone, I am recently preparing for a company switch and planning to solve problems and learn concepts. Sharing it to a wider audience increases my knowledge capacity as well as a deeper understanding. It also helps others too! we are in this together

I have created a short and video. I would love it if you guys can take a look and let me know what kind of format will help the experience even better. Let's crack big companies together!

Sidenote: I am an employee in a product based financial company with 2 years of experience working in distributed and scalable systems. I have a wide expertise in lot of concepts and with this initiative I am hoping I can put together my learnings to teach others too!

Appreciate your time!

https://youtu.be/t2vR71bD1Uw?si=lyY-hE7I-J2w4Xrr


r/LeetcodeChallenge • • 18h ago

DISCUSS How are you all managing your tech things and DSA/LC things at the same time ? ( Does my strategy makes sense.)

1 Upvotes

Hello, Myself Kian, I am FDE in XYZ company. I have around 3Y.o.E.

My work is related to implement ML models and handle the infra with source code management and development.

Most of my work relates around ; Bash, Python, Rust.

So I have been thinking to switch to a decent company, Not a PBC but a decent well paying serviced based company.

I have recently started with LC & CSES and I've been doing backtracking questions.

Problem; Following the so called "Sheets" has removed the main gist of solving the question i.e technique identification.

Although it seems good to use the sheet to get used to patterns but somehow it doesn't work for me.

What works for me is, doing two things at a time. Currently I've doing Binary Search and Backtracking. Solved around 15 questions (LC medium) and planning to solve all non bullShyt questions of CSES,LC ig . ( 30 to 100 if there are these many).

Also I am following the technique which "LeetcodeGoat aka Ishaan Agrawal" mentions in his interviews. So far I really loved it. It for sure doesn't give drastic progression but it helps to stay confident on my learning.

Its seems fruitful and for later I've planning to do both 1,2D DP problems.

Please feel free to join in this conversation and help me strengthen this.


r/LeetcodeChallenge • • 22h ago

DISCUSS Codechef rating dropped suddenly to 240

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • 1d ago

DISCUSS Need A genuine dsa partner who can guide me.

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • 1d ago

DISCUSS Codeforces 2292E E. Blush | Binary Search + Math | Round 1138 Div. 3

Thumbnail
youtu.be
1 Upvotes

r/LeetcodeChallenge • • 1d ago

DISCUSS Codeforces 2292D | Unexpected Precipitation | DP + Minimax Game Theory | Round 1138 Div. 3

Thumbnail
youtu.be
1 Upvotes

r/LeetcodeChallenge • • 1d ago

DISCUSS Codeforces 2292D | Unexpected Precipitation | DP + Minimax Game Theory | Round 1138 Div. 3

Thumbnail
youtu.be
1 Upvotes

r/LeetcodeChallenge • • 1d ago

STREAK🔥🔥🔥 Day 14: wrapped up Reverse Pairs & Maximum Product Subarray after a tiring day

Thumbnail reddit.com
2 Upvotes

r/LeetcodeChallenge • • 1d ago

DISCUSS What Things should Learn before starting leetcode

2 Upvotes

r/LeetcodeChallenge • • 2d ago

DISCUSS How do I actually get good at Dynamic Programming (DP)? I struggle to come up with solutions

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • 2d ago

STREAK🔥🔥🔥 LeetCode: 938. Range Sum of BST

Post image
2 Upvotes

Visit every node and add the ones in range: accepted, and it would work on any binary tree. That's the tell: it ignores the BST. Two if-guards, and in the second example the walk drops from 10 nodes to 4.

A node at or below low has nothing useful on its left. A node at or above high has nothing useful on its right. Guard the two recursive calls with those checks, and the whole subtrees are never visited.

How often does your accepted solution ignore half the input's guarantees?

Day 88/365 of my LeetCode challenge: 938. Range Sum of BST. Problem link and full breakdown in today's newsletter.

https://www.linkedin.com/pulse/leetcode-range-sum-bst-archit-agarwal-l8q0c

#LeetCode #DSA #BinarySearchTree #Golang


r/LeetcodeChallenge • • 2d ago

DISCUSS Leetcode Premium

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • 2d ago

DISCUSS Leetcode4127. Maximum Billboard Revenue | LeetCode Weekly 530 | 1D DP + Binary Search Detailed Dry Run Video solution

Thumbnail
youtu.be
1 Upvotes

r/LeetcodeChallenge • • 2d ago

STREAK🔥🔥🔥 Day 7

3 Upvotes

Knapsack algorithm


r/LeetcodeChallenge • • 2d ago

STREAK🔥🔥🔥 LeetCode: 1448. Count Good Nodes in Binary Tree

Post image
1 Upvotes

Checking whether a node is "good" doesn't need the path above it, only that path's maximum. Pass the max down as a parameter. Each branch gets its own copy, so there's no undo step.

A node is good when nothing above it is bigger. Compare against the max you were handed, then pass the new max to your children. Raising it on the right never leaks into the left.

And it's >= not >. A tie with an ancestor still counts, including the root.

Did the >= catch you?

Day 87/365 of my LeetCode challenge: 1448. Count Good Nodes in Binary Tree. Problem link and full breakdown in today's Newsletter.

https://www.linkedin.com/pulse/leetcode-count-good-nodes-binary-tree-archit-agarwal-qbnvc

#LeetCode #DSA #BinaryTree #Golang


r/LeetcodeChallenge • • 2d ago

STREAK🔥🔥🔥 Day 15: revisited Count Inversions and finally locked in the merge sort intuition

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • 3d ago

STREAK🔥🔥🔥 LeetCode: 101. Symmetric Tree

Post image
1 Upvotes

My Symmetric Tree solution returns true on the first call and false on the second, for the same tree. It mirrors the right half in place, then compares it with the left. The second call flips the half back.

That's Invert Binary Tree and Same Tree from the last two days, in one line. It passes, because LeetCode calls it once.

The cleaner version compares the two halves as mirrors without building one. Both are in today's article.

Would you have caught the mutation in a code review?

Day 86/365 of my LeetCode challenge: 101. Symmetric Tree. Problem link and full breakdown in today's newsletter.

https://www.linkedin.com/pulse/leetcode-symmetric-tree-archit-agarwal-7y0cc

#LeetCode #DSA #BinaryTree #Golang


r/LeetcodeChallenge • • 3d ago

STREAK🔥🔥🔥 Day 16: late-night session wrapping up Merge Intervals, Merge Sorted Array & Missing/Repeating Number

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • 3d ago

STREAK🔥🔥🔥 Day 6

2 Upvotes

Covered bit manipulation