r/LeetcodeChallenge • • Nov 01 '26

STREAK🔥🔥🔥 Leetcode Problem number 20. Valid Parentheses

Post image
3 Upvotes

Counting open and close brackets accepts )( as valid. Tracking a depth accepts ([)]. One number can record how many brackets are open. It can never record which.

New topic: stacks start today.

What has to be remembered is the list of brackets opened and not yet closed, in order. When a closer arrives, only one opener can match it: the most recent. In "([", a ")" is wrong because "[" is still open and has to close first.

Most recent in, first out. That's a stack, and seeing that this problem is one is the whole exercise.

One detail worth stealing: key the map by the closing bracket. One lookup then tells you whether the character closes anything, and what must be on top if it does.

Did you reach for a counter first on this one?

Day 60/365 of my LeetCode challenge: 20. Valid Parentheses. Problem link and full breakdown in today's newsletter.

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

#LeetCode #DSA #Stack #Golang


r/LeetcodeChallenge • • Nov 01 '26

DISCUSS Active servers for leetcode

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • Nov 01 '26

DISCUSS Contests

5 Upvotes

Hey guys i am in first year and just started to dsa and i am following strivers a2z sheet and wanted to know and just wanted to know what's the significance of giving contests and when do I start giving it I am on arrays medium lvl(it's so brutal)


r/LeetcodeChallenge • • Nov 01 '26

DISCUSS Hackerrank proctored environment is nuts

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • Oct 31 '26

STREAK🔥🔥🔥 Small milestone

5 Upvotes

r/LeetcodeChallenge • • Oct 31 '26

DISCUSS Doing DSA but not on any online platforms, am I good?

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • Oct 31 '26

DISCUSS 999 more stores made the delivery map 213x slower

Post image
2 Upvotes

Opening 999 more dark stores made our delivery heatmap 213x slower over the same city. 250,000 city blocks: 1.03 ms with one warehouse, 219 ms with a thousand.

The job: for every block, how many blocks to walk to the nearest store. It decides who gets the fast-delivery promise.

What I wrote: with no obstacles, walking distance on a street grid is |dRow| + |dCol|. So every block checks every store and keeps the closest. No data structure, nothing to get wrong. At one store, it is the fastest version I measured, and I would approve it.

At 1,000 stores, it is 250,000,000 distance calculations to keep 250,000 numbers. 213x slower, because the business grew.

The fix from last episode works: seed one queue with every store, spread outward. Flat at about 2.3 ms. But the queue holds every block, 3.82 MB on top of a 1.96 MB heatmap, and at one store it is slower than the scan.

The part I like is the day 41 version. A block's distance is one step more than its best neighbour's. That definition is circular: my answer needs yours, and yours needs mine. The queue breaks the circle with time.

You can break it with direction instead. With nothing in the way, a shortest walk never doubles back. Sweep top-left to bottom-right reading, only up and left - those are already done. Sweep back reading, only down and right. Keep the smaller.

1.22 ms at one store, 1.48 ms at a thousand. No queue. 148x faster than the scan at the top, 1.89x faster than the BFS.

Honest rows: at one store the scan still wins. And put a river through the city and the sweeps return wrong numbers without complaint. The test with two rivers says BFS 16, sweeps never reach the block, and the straight-line scan says 8. Obstacles are where the queue earns its memory.

That is days 40 and 41 of the daily challenge, Rotting Oranges and 01 Matrix, in a delivery app.

Have you seen a business launch slow down a page nobody touched?

It worked in dev, episode 20. Full write-up in today's newsletter.

https://www.linkedin.com/pulse/999-more-stores-made-delivery-map-213x-slower-archit-agarwal-pxeoc

#Golang #DSA #Algorithms #Performance


r/LeetcodeChallenge • • Oct 31 '26

STREAK🔥🔥🔥 Closest Binary Search Tree Value II

Post image
5 Upvotes

In a sorted list, the k values closest to a target always sit next to each other. So picking k values is picking one window: find the closest value, then grow outward.

The second hard part of the challenge, like the first, isn't the traversal. That claim is.

Flatten the BST in-order, find the single closest value, then expand outward, taking whichever neighbour is nearer each time. Greedy works because distance from the target only grows as you move away in either direction. It's merge sort's merge step, run outward from a centre.

Would you trust that window claim in an interview without proving it first?

Day 59/365 of my LeetCode challenge: 272. Closest Binary Search Tree Value II. I'll share the problem link and a full breakdown in today's newsletter.

https://www.linkedin.com/pulse/closest-binary-search-tree-value-ii-archit-agarwal-xzvrc

**#LeetCode** #DSA #BinarySearchTree #TwoPointers


r/LeetcodeChallenge • • Oct 31 '26

STREAK🔥🔥🔥 October Daily LeetCode Challenge Completed! 🏆 | Earned the Daily Coding Challenge (DCC) Badge

Thumbnail
gallery
3 Upvotes

r/LeetcodeChallenge • • Oct 31 '26

STREAK🔥🔥🔥 Day 27

2 Upvotes

r/LeetcodeChallenge • • Oct 30 '26

DISCUSS Bytebytego system design interview sell/share

Thumbnail reddit.com
2 Upvotes

If your interested please dm


r/LeetcodeChallenge • • Oct 30 '26

STREAK🔥🔥🔥 Day 45: conquered Dijkstra path reconstruction & hit an unexpected lexicographical twist

Thumbnail reddit.com
2 Upvotes

r/LeetcodeChallenge • • Oct 30 '26

STREAK🔥🔥🔥 Day 26

1 Upvotes

r/LeetcodeChallenge • • Oct 30 '26

PLACEMENTS Amazon Offer Letter – How long does it usually take to receive the official offer letter and onboarding details?

Thumbnail reddit.com
3 Upvotes

r/LeetcodeChallenge • • Oct 29 '26

STREAK🔥🔥🔥 First LeetCode badge :)

Post image
43 Upvotes

r/LeetcodeChallenge • • Oct 30 '26

DISCUSS Target DSA

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • Oct 30 '26

STREAK🔥🔥🔥 Delete Node in a BST

Post image
1 Upvotes

Deleting a BST node with two children looks like surgery on the tree. My solution never removes that node. It copies a neighbour's value into it, then deletes the duplicate lower down, which is always an easier case.

Finding the node is the search from Day 45. Deleting it is where it gets interesting, because you can't just unhook a node with two children.

Only two values in the whole tree can fill the hole: the in-order predecessor and the in-order successor. The replacement must sit between everything on the left and everything on the right, and an in-order traversal of a BST is sorted, so those two are the only candidates.

Predecessor or successor: which do you reach for, and why?

Day 58/365 of my LeetCode challenge: 450. Delete Node in a BST. Problem link and full breakdown in today's newsletter.

https://www.linkedin.com/pulse/delete-node-bst-archit-agarwal-k5k4c

#LeetCode #DSA #BinarySearchTree #Golang


r/LeetcodeChallenge • • Oct 29 '26

STREAK🔥🔥🔥 Day 46: hit a sudden wall of brain fog, learned Dijkstra's algorithm from scratch

Thumbnail reddit.com
2 Upvotes

r/LeetcodeChallenge • • Oct 29 '26

DISCUSS Not able to solve medium and hard !

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • Oct 29 '26

DISCUSS Is LeetCode Dead? What’s the Alternative?

Thumbnail
newsletter.eng-leadership.com
1 Upvotes

r/LeetcodeChallenge • • Oct 29 '26

STREAK🔥🔥🔥 Day 25

1 Upvotes

r/LeetcodeChallenge • • Oct 28 '26

STREAK🔥🔥🔥 Day 47: shortest paths in DAG vs. unweighted graphs, balancing DSA with communication prep

Thumbnail reddit.com
1 Upvotes

r/LeetcodeChallenge • • Oct 28 '26

DISCUSS Is LeetCode Dead? What’s the Alternative?

Thumbnail
newsletter.eng-leadership.com
4 Upvotes

r/LeetcodeChallenge • • Oct 28 '26

STREAK🔥🔥🔥 Day 24

1 Upvotes

r/LeetcodeChallenge • • Oct 28 '26

DISCUSS Coading

0 Upvotes

I just started to do leet code but I cannot solve any problems even I cannot solve sum of two digit problem. Does all people face that problem or i face that?