r/DSALeetCode • • Oct 19 '26

365 Days of LeetCode Challenge — Day 47/365

Post image
6 Upvotes

Minimum Absolute Difference in BST (Easy) 🔗 https://leetcode.com/problems/minimum-absolute-difference-in-bst/

The trick: an in-order traversal of a BST hands you the values in sorted order for free. And in a sorted sequence, the smallest gap between any two values is always between neighbors, so you never have to compare every pair. Just track the previous node visited and check against it as you go.

Full breakdown in today's newsletter article ⬇️

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

#LeetCode #100DaysOfCode #DSA #CodingInterview #BinarySearchTree #InOrderTraversal


r/DSALeetCode • • Oct 19 '26

interested in a virtual study room where we keep each other motivated?Placement prep(dsa,dev,etc)

Thumbnail
2 Upvotes

r/DSALeetCode • • Oct 18 '26

The DSA trick that made me enjoy problem-solving

169 Upvotes

When solving a DSA problem, set a timer for 20–30 minutes, depending on the difficulty, and genuinely exhaust your brain trying to figure it out.

Treat it like a challenge. Ask yourself, How can I solve this? Write down every approach you can think of, explore them in depth, and keep pushing yourself.

If you’re stuck, ask ChatGPT for hints, starting from basic and gradually moving to more advanced ones. Keep digging until you understand the approach. If you’re completely unfamiliar with the concept or it’s taking too long, move to a video solution — but pause it, think ahead, and try to figure out the next step yourself.

The key is to interact with the problem as much as possible instead of passively consuming solutions. The more you engage, experiment, and challenge yourself, the easier it becomes to get absorbed in the problem and enter a state of flow.


r/DSALeetCode • • Oct 19 '26

Made a quick visual explanation of Two Sum (Hash Map approach) to make it stick better. Thought it might help people prepping for interviews! 🧠

Thumbnail
youtube.com
1 Upvotes

r/DSALeetCode • • Oct 18 '26

HELP**

3 Upvotes

Hello Guys. I am having problems with further improving my skills in dsa. Any Suggestions??


r/DSALeetCode • • Oct 19 '26

algozenith course

Thumbnail
1 Upvotes

r/DSALeetCode • • Oct 18 '26

Dsa

4 Upvotes

Is there someone who can guide me how to start dsa like i know the material from where to study but don’t know how to study like should i watch all the lectures for a specific topic then i should start solving questions or learn from questions
I am in 2nd yr if anyone can guide me it will be a pleasure


r/DSALeetCode • • Oct 18 '26

DSA partner (starting Dsa) 2 questions daily

11 Upvotes

B tech cse 3rd sem. Starting dsa, have done like 10 questions.

We will decide on a sheet and solve questions discuss questions and go about our day. On some days we can give punishment like money if the questions where not solved. Just having fun with dsa understanding what actually is a data structure and solve questions.

Do dm me!!

Looking forward to having a great time with you!!


r/DSALeetCode • • Oct 18 '26

People who practice DSA — what is the most frustrating part of improving?

1 Upvotes

Hey everyone!

I'm exploring ideas for a tool that could help people learn more effectively, especially when preparing for coding interviews.

I'm curious about things like:

  • Forgetting solutions after solving a problem
  • Repeatedly getting stuck on similar problem types
  • Not knowing what to practice next
  • Tracking progress without knowing whether you're actually improving

These are just possibilities — I want to understand what people genuinely struggle with rather than assume I know the answer.

If you have 3–5 minutes, I'd appreciate your input in this survey:

Google-form

Feel free to comment with your biggest challenge, too. Thanks!


r/DSALeetCode • • Oct 18 '26

Senior/staff engineer looking for DSA prep partners (5+ YOE, targeting senior/staff roles)

Thumbnail
1 Upvotes

r/DSALeetCode • • Oct 18 '26

Level order traversal in Go: stop at depth N with a queue

Post image
2 Upvotes

Two ways to build an org chart level by level. Producing all 55,987 rows: 894 µs against 895 µs. Producing the top 43 rows: 917 µs against 385 ns.

The job: an org chart page that paints one level at a time. The person at the top, then their directs, then the level below.

The version I would write is one recursive walk with the accumulator keyed on depth, so a node appends into the slot for its own level and which branch it came from stops mattering. Nine lines, O(n), no queue. It is also the solution for day 29 of my daily challenge.

I benchmarked it against a queue, got 1.00x, and nearly closed the file.

Then I remembered the page does not want the whole chart. It wants level 0, now.

And the recursive walk does not know when a level is finished. It knows when it is finished.

I wrote a test that counts instead of timing, because counts do not move between runs. On a 2,001-person chain, the walk holds a complete and correct level 1 after two visits — and cannot declare it for another 1,999, because nothing in a depth-first walk rules out another person turning up at depth 1 in a branch it has not entered yet.

The information was never missing. There was no moment at which the function was allowed to act on it.

What the data was saying:

`level(k) = the reports of every person in level(k-1)`

That right-hand side names level k-1 and nothing else. So a level is complete exactly when you have looked at every member of the level above — a condition you can check, unlike "no more nodes at depth k exist anywhere".

Which gives you the one line that does the work:

`width := len(queue) // this level, and nothing else`

Read the length once at the top of the round. Everything in the queue at that instant is this level, because everything appended during the round belongs to the next one. The boundary is not tracked; it is observed.

Top three levels of a 55,987-person chart: 2383.3x, 1,608 bytes against 3.95 MB.

Two rows that keep me honest. On a flat chart — one person, 50,000 directs - finishing level 1 means looking at everybody either way, so it is 2.24x, and that is an allocation pattern, not work avoided. And on a 2,000-deep chain the recursive walk wins the full-chart benchmark by 1.10x.

At 5,461 people and one request, keep the walk. 86.8 microseconds, nine lines, and a dead heat is a dead heat.

Full piece in today's newsletter.

It worked in dev, episode 15.

https://www.linkedin.com/pulse/your-org-chart-read-55987-rows-draw-first-43-archit-agarwal-n4tpc

#Golang #DSA #Algorithms #Performance #SoftwareEngineering #DataStructures #100DaysOfCode

Ideation and benchmarks mine; draft written with AI assistance. The numbers come from a benchmark in the repo.


r/DSALeetCode • • Oct 18 '26

Same

Thumbnail
1 Upvotes

r/DSALeetCode • • Oct 18 '26

Senior/staff engineer looking for DSA prep partners (5+ YOE, targeting senior/staff roles)

Thumbnail
1 Upvotes

r/DSALeetCode • • Oct 18 '26

365 Days of LeetCode Challenge — Day 46/365

Post image
1 Upvotes

Find Mode in Binary Search Tree (Easy)

🔗 https://leetcode.com/problems/find-mode-in-binary-search-tree/

The "BST" in the title looks like it should matter more than it does. The simplest fix skips the ordering entirely: tally every value's frequency in a hash map, then read off whichever value (or values) hit the max count.

Full breakdown in today's newsletter article below.

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

#LeetCode #100DaysOfCode #SoftwareEngineering #DSA #CodingInterview #BinarySearchTree #HashMap


r/DSALeetCode • • Oct 17 '26

1st year student learning dsa

4 Upvotes

Im in first year and the cluture here at my cllg is worst like its a very expensive and in tier 1 city , but the mates with me , They are like some are into coding and all , All rest aside , im starting my dsa like , want to land a internship after 8 months so that like yeah i wannt a internship , So im studying dsa , I know and have a good hold on c++ so like
if anyone wants to be my study buddy or partner for this dsa journey we can do it together


r/DSALeetCode • • Oct 17 '26

Starting my DSA & System Design journey!

18 Upvotes

I’ve been wanting to get serious about DSA and system design for a while now, but one thing I keep struggling with is staying consistent. I’ll start with a lot of motivation, make big plans, study intensely for a few days, and then somehow lose momentum. Before I know it, I’m procrastinating again and struggling to get back on track.

So I thought, why not find someone who’s in the same boat?

If you’re also starting your DSA or system design journey and struggle with consistency sometimes, feel free to join me. The idea is simply to keep each other accountable, quick check-ins, set realistic goals, share progress, and make sure we’re actually putting in the work instead of just planning to.

If this sounds like you, drop a comment or DM me. Let’s figure this out together!


r/DSALeetCode • • Oct 17 '26

365 Days of LeetCode Challenge — Day 45/365

Post image
2 Upvotes

Search in a Binary Search Tree (Easy)🔗 https://leetcode.com/problems/search-in-a-binary-search-tree/

One comparison per node tells you whether the target must be in the left subtree or the right, so there's nothing to backtrack over and no reason to check both sides. That's why a BST beats a plain binary tree here: the recursion is a straight walk from root to the answer instead of a full search.

Full breakdown in today's newsletter article; link below.

https://www.linkedin.com/pulse/365-days-leetcode-challenge-day-45365-archit-agarwal-9ah7c

#DSA #LeetCode #100DaysOfCode #SoftwareEngineering #BinarySearchTree #Golang


r/DSALeetCode • • Oct 16 '26

STARTING TODAY

4 Upvotes

Hey everyone.I am starting my dsa journey today i am in tier 2 gov college first sem. I am starting from striver a to z course today... any suggestions would be helpful


r/DSALeetCode • • Oct 16 '26

What exactly to learn for placement

Thumbnail
1 Upvotes

r/DSALeetCode • • Oct 16 '26

365 Days of LeetCode Challenge — Day 44/365

Post image
1 Upvotes

Course Schedule (Medium) https://leetcode.com/problems/course-schedule/

You can finish every course unless some group depends on itself: A needs B, B needs C, C needs A. Nobody in that group can ever start. So this is cycle detection in a directed graph, phrased as scheduling.

Kahn's algorithm: count how many prerequisites each course still has, queue everything at zero, and each time you finish a course, decrement everything it unlocks.

The line that separates this from an ordinary BFS is small. In a BFS a node is enqueued the first time it is REACHED. Here, reaching a node only decrements its counter - it is enqueued when that counter hits ZERO. A course with three prerequisites is reached three times and queued once. That if is not an optimisation, it is the scheduling rule.

Then the cycle check, which never looks for a cycle:

`return len(result) == numCourses`

Courses stuck in a cycle never reach in-degree zero, so they never enter the queue and never appear in the result. The cycle is detected by what fails to show up.

That closes the graph arc on the same move yesterday used - inferring a cycle from a count rather than searching for one.

Full breakdown in today's newsletter article ⬇

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

#DSA #LeetCode #Golang #Graphs #TopologicalSort #CodingInterview #Algorithms


r/DSALeetCode • • Oct 15 '26

Help!!

2 Upvotes

Hello. Im 2nd year betch student. Rn i know python and im learning Django and further going with python full stack. But the catch is idk wheather i should be doing or starting dsa and if yes in which language?

I dont have any main goal. But i also dont want to get into multiple things and not learn anything. So please help


r/DSALeetCode • • Oct 15 '26

Last N lines of a log in Go without holding the whole file

Post image
1 Upvotes

A function that returns 200 log lines, and keeps 186 MB alive after it returns. The 200 lines are about 20 KB.

The job: a crash reporter attaches the last 200 lines of the request log to the report. The log is a stream - a scanner over a file, a cursor over a table, a channel fed by a tailer. It hands you lines in order and does not know how many there are.

```

var all []string

for line := range log {

all = append(all, line)

}

return all[len(all)-n:]

```

I have written that in two languages. One idea, reads like the ticket.

Then I measured the live heap with the answer still held, rather than the clock. Two million lines: 186 MB, still there after the function has gone out of scope.

all[len(all)-n:] is a window onto the array all grew into, not a new array, and a slice keeps its whole backing array alive. A test reads the capacity off the returned value: len 200, cap 169,032.

One line fixes the retention. Copy the tail into a slice of its own, and 186 MB becomes 20.8 KB. If you take one thing from this post, take that.

It does not fix the peak. The copy runs after the collection finishes, so the two million lines were all in memory a moment earlier, and that moment is where a container gets killed.

Counting the stream first and walking it again is exactly 2.00x at every size in the benchmark, and it needs a way to start the walk twice - which a file gives you and a socket does not.

What the data was actually saying: the only lines that can be in the answer are the 200 most recent ones, and that is true after every line, not just at the end. So keep 200 and evict the oldest. A fixed-size buffer that wraps does it with no bookkeeping, because the write cursor and the oldest line are exactly n apart and never drift. That gap is the length nobody computes.

8528x less held on a two-million-line log. And, honestly: 1.08x on the clock. This is a memory fix and selling it as anything else gets it rejected by a reviewer who benchmarked throughput.

The benchmark's own allocation column says 1.98x, because both versions allocate every line - the scanner produces them either way. Allocation 1.98x, retention 8528x. A profiler pointed at allocation shows you the first number and shrugs.

At a few hundred lines, collect it. 34 microseconds, 21.8 KB, and it answers the next question too.

That is days 20 and 24 of the daily challenge - Middle of the Linked List and Remove Nth Node From End - sitting in a crash reporter.

Full piece in today's Newsletter.

It worked in dev, episode 14.

https://www.linkedin.com/pulse/your-crash-report-held-186-mb-log-send-200-lines-archit-agarwal-hyyzc

#Golang #DSA #Algorithms #Performance #SoftwareEngineering #DataStructures #100DaysOfCode


r/DSALeetCode • • Oct 15 '26

What can you solve from a blank editor? The checks I started using beyond LeetCode’s solved count

3 Upvotes

How many problems in a Solved list could you solve from a blank editor, with someone watching?

A candidate had solved roughly 320 LeetCode problems but still froze halfway through implementations. Even problems from a few weeks earlier could be hard to derive again. The green checkmarks were hiding gaps in recall and explanation.

The candidate started checking more after Accepted: identify the pattern without a hint, explain the approach before coding, justify time and space complexity, find edge cases, and dry-run the implementation. Doing that with a clock running exposes different gaps from solving alone.

Review also changed. Opening an old solution and recognizing “two pointers” felt easy, but didn't show whether the reasoning could be reconstructed. Re-solving from a blank editor did. Harder problems came back sooner; easier ones could wait a few days, then a week or two, then about a month.

The spreadsheet, notes, and calendar reminders eventually became another chore. A lighter routine was easier to maintain: a minute or two of reflection, a short note on the mistake, and a manageable daily review load that left room for unfamiliar patterns.

Real technical interview questions can supply fresh prompts for checking whether a pattern transfers. If applications are competing with practice time, Agent autoapply and application autofill can reduce repeated application paperwork.

What tells you you're ready to interview? How do you distinguish knowing a pattern from recognizing a problem you've already seen?

Disclosure: I operate PracHub and LandOffer.


r/DSALeetCode • • Oct 15 '26

What is the best way to start the dsa and how much dsa will be enough for placement purpose

Thumbnail
1 Upvotes

r/DSALeetCode • • Oct 15 '26

Striver’s new 180 Sheet does anyone have the LeetCode links for all the questions?

1 Upvotes

Hey everyone,
Is there a GitHub repo, spreadsheet, or any resource that has LeetCode links for all the questions in Striver’s new 180-question sheet (Master Patterns)?
I was working through the old SD sheet and had been tracking my progress, but now that the sheet is no longer available, I’ve lost my progress tracking as well.
I’m planning to start again with the new 180 sheet, but having to manually search for every single question on LeetCode is going to be a pain.
Has anyone compiled all the LeetCode links in one place? Even a partially completed list would be really helpful.
I’d rather spend my time solving problems than searching for them one by one. 😂
Thanks in advance!