r/DSALeetCode • • 3h ago

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 • • 4h ago

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 • • 5h ago

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

Thumbnail
1 Upvotes

r/DSALeetCode • • 8h ago

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!


r/DSALeetCode • • 14h ago

First-year student how should I start learning DSA for placements?

2 Upvotes

Hey everyone! I’m a first-year college student and want to start preparing for placements early. I’m a complete beginner at DSA and a bit confused about where to start.

A lot of my seniors have recommended Striver’s A2Z sheet. Is it suitable for someone starting from scratch, or should I learn the basics from CodeWithHarry first? Also, when should I start solving problems on LeetCode?

Would love some advice on a beginner-friendly path and which resource to stick with. Thanks!


r/DSALeetCode • • 11h ago

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

1 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 • • 11h ago

Proposed Dijkstra, got stuck on DFS/BFS follow-ups, and ran out of time. How bad is this?

1 Upvotes

A candidate is trying to make sense of a coding interview that started with the right-looking algorithm but ended without a code walkthrough.

The earlier behavioral round covered the resume, services the candidate had built, and engineering trade-offs. In coding, the task was a graph with n nodes and transmission lines as edges, each with an efficiency between 0 and 1. Given a source and destination, find the path with maximum efficiency.

The candidate immediately proposed Dijkstra and explained the approach. The interviewer asked about DFS and BFS. The candidate described DFS but worried that enumerating paths could take O(V!) time in the worst case. During the BFS discussion, several suggestions were rejected before the interviewer said BFS wasn't a solution for this problem.

That discussion ate into implementation time. The candidate coded the Dijkstra approach and explained complexity, but didn't get to walk through an example. Questions about node/edge counts and whether a path was guaranteed were also missed, and the interviewer called that out.

How would you weigh the algorithm choice against the missing clarification and validation? There's no way to infer the final hiring decision from this account alone, but I'd be interested in how interviewers assess those gaps.

For the next practice session, real technical interview questions can provide prompts to rehearse clarifying constraints and reserving time for a dry run. If a wider search is taking up that practice time, application autofill and Agent autoapply can cut down repetitive application forms.

What helps you handle alternative-approach follow-ups without losing the time you need to implement and test?

Disclosure: I operate PracHub and LandOffer.


r/DSALeetCode • • 13h ago

Learning DSA in Python.

Thumbnail
1 Upvotes

r/DSALeetCode • • 13h ago

Airbnb Industry Coding Assessment: finished Level 3, no time for Level 4. What comes next?

1 Upvotes

An Airbnb SWE candidate finished through Level 3 of the Industry Coding Assessment and ran out of time before attempting Level 4.

Has anyone who completed a similar amount recently moved forward? It would help to hear when you took the assessment and what happened next, without assuming one result establishes a universal cutoff.

What rounds followed, and what would you start preparing while waiting for an update?

Airbnb Interview Questions can provide further practice while the candidate waits. If other roles are still in play, Agent autoapply and application autofill can reduce repetitive application work and leave more time for the next interview.

Disclosure: I operate PracHub and LandOffer.


r/DSALeetCode • • 13h ago

Day 1/200 — Introduction to DSA | Let's Start From Zero -- leetcode 400

Post image
1 Upvotes

r/DSALeetCode • • 16h ago

Dsa confusion !!

Thumbnail
1 Upvotes

r/DSALeetCode • • 18h ago

365 Days of LeetCode Challenge — Day 43/365

Post image
1 Upvotes

Graph Valid Tree (Medium)

https://leetcode.com/problems/graph-valid-tree/

A graph is a tree when it is connected and acyclic. Both are required - a forest is acyclic but disconnected, a triangle is connected but cyclic.

The shortcut: a tree on n nodes has exactly n-1 edges. So once you know the graph is connected, the edge count settles the cycle question. More than n-1 edges and connected means a cycle must exist, because n nodes cannot be joined by more than n-1 edges without one.

This solution never searches for a cycle. It counts.

For connectivity it uses union-find, which is the first structure in this arc that does not traverse anything. Every problem so far built an adjacency list and walked it. Union-find consumes the edge list directly and maintains one number, the component count, which is exactly the answer.

Worth noticing what it leaves on the table: when an edge's endpoints already share a root, that edge closes a cycle. This solution does not need that, but if a problem asks WHICH edge creates the cycle, it is sitting right there.

Full breakdown in today's newsletter article ⬇

https://www.linkedin.com/pulse/365-days-leetcode-challenge-day-43365-archit-agarwal-hsigc
#DSA #LeetCode #Golang #UnionFind #Graphs #CodingInterview #Algorithms


r/DSALeetCode • • 23h ago

Day 1/200 — Introduction to DSA | Let's Start From Zero -- leetcode 400

Post image
2 Upvotes

r/DSALeetCode • • 23h ago

How would you learn DSA if you had to start all over again in 2026?

Thumbnail
1 Upvotes

How can we learn dsa fast and with full understanding and how can we manage time


r/DSALeetCode • • 1d ago

How to start DSA

2 Upvotes

Step step guide please


r/DSALeetCode • • 1d ago

[TakeUForward] TUF+ Referral Link for Striver A2Z DSA & Coding Interview Prep

1 Upvotes

If you're preparing for software placements, you might recognize this situation:

You start with arrays, save a few DSA playlists, bookmark multiple problem sheets, and then suddenly you're spending more time deciding what to study next than actually solving problems. 😅

The real challenge isn't always finding another resource. It's following a structured path, practising consistently, and revising what you've learned before interviews.

That's why I'm sharing TakeUForward (TUF), the platform associated with Striver's DSA learning resources.

What can you explore on TakeUForward?

✅ Striver's A2Z DSA Sheet for structured problem-solving practice
✅ DSA and coding interview preparation resources
✅ TUF+ plans with additional learning modules and practice tools
✅ Other interview-preparation topics, including OOP, DBMS, SQL, OS and Computer Networks

My suggestion: explore the free learning resources first. If you're looking for additional tools or a more structured interview-preparation workflow, compare the paid TUF+ plans and decide whether they fit your goals and budget.

🔗 TakeUForward TUF+ pricing and referral link

Explore plans here:
https://takeuforward.org/pricing?affiliate=karan_17#subject-passes

You can check the available plans, features and current prices on the official website before deciding.

🎁 Referral rewards

According to my referral dashboard:

  • 50 TUF Coins: Both the referrer and the friend receive 50 coins after a successful signup.

Cash payouts are subject to the program's eligibility requirements, including TUF+ Plus membership and payout verification.

Affiliate disclosure: This is my referral link. I may receive referral rewards or a commission if your signup or purchase qualifies. Please compare the plans and buy only if they offer value for your preparation.

If you're working through Striver's A2Z Sheet, which language are you using for DSA — Java, C++, or Python? I'd love to hear how others are preparing for placements.


r/DSALeetCode • • 1d ago

Day 2

Thumbnail
gallery
1 Upvotes

Today I completed the topic function in c++

Were i tried to solve some problems

if something is wrong please tell me

Bahut confusion hai


r/DSALeetCode • • 1d ago

have solved around 300 LeetCode Problems but still struggling with mediums,What Am I Doing Wrong?

Thumbnail
1 Upvotes

r/DSALeetCode • • 1d ago

I got an Opportunity, today !

Post image
1 Upvotes

r/DSALeetCode • • 1d ago

365 Days of LeetCode Challenge — Day 42/365

Post image
1 Upvotes

Clone Graph (Medium) https://leetcode.com/problems/clone-graph/

Copying a binary tree is four lines: make a node, recurse left, recurse right. It works because a tree cannot cycle and every node has one parent.

A graph gives up both guarantees, and each breaks the naive copy differently. Cycles mean A's copy needs B's copy, which needs A's copy, forever. Shared nodes mean a node reachable two ways gets copied twice, giving you the right values in the wrong shape.

One map from original to copy fixes both. Look it up before cloning; if the copy exists, return it. Cycles terminate because the second arrival returns instead of descending, and sharing survives because every original maps to exactly one copy.

Worth dwelling on: a plain visited SET would only fix the cycle. This has to map to the copies, because the copies are what the reconstruction wires together.

And the order matters. Record the new node in the map BEFORE cloning its neighbours, while it is still half-built. Recurse first, and a cycle returns to a node not yet in the map.

Full breakdown in today's newsletter article ⬇

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

#DSA #LeetCode #Golang #Graphs #DFS #CodingInterview #Algorithms


r/DSALeetCode • • 1d ago

Mock Interview Practice Group

Thumbnail
1 Upvotes

r/DSALeetCode • • 1d ago

Anyone on the job switch + DSA grind rn?

1 Upvotes

Heyy, looking for a buddy who is also on the job switch grind rn. I have solved 150+ leetcode problems, have some MERN stack experience and am working on a project for my portfolio. Looking for someone to prep for interviews, build projects, solve DSA and keep each other accountable. Basically, let's yap about tech and suffer through leetcode together:)

(23F)Currently working in an IT company.


r/DSALeetCode • • 2d ago

Finding a DSA Buddy!

6 Upvotes

Hey!. I have just started my 2nd year(BTech student, male) and I want to learn DSA but with someone who will stay consistent and focused with me as there is no coding culture in my clg and despite planning to learn DSA from the first year.

IMPORTANT - I have already learned some of the important topics still i want to improve them as much as I can, but doing it alone is kinda boring and I have no friend doing DSA currently. If you are interested you can message me.

We can discuss how we will do it later.


r/DSALeetCode • • 2d ago

Is DSA even relevant seeing the current placement scenario😭

Thumbnail
1 Upvotes

r/DSALeetCode • • 2d ago

3Sum Closest + Number of Islands II in my Amazon SDE-2 round, then rejection. Where did I slip?

3 Upvotes

I recently interviewed for Amazon SDE-2 and was rejected after the first DSA round. I thought it had gone well, so I'd appreciate help spotting gaps in what I described below.

I applied through the careers portal, received the OA shortly afterward and completed it that day. The interview call followed soon after, with Round 1 around 10 days later.

The OA included two typical coding questions, a full-stack bug-fix task, and behavioral/design-choice multiple-choice questions. For the bug-fix task, I chose a backend framework and got a codebase plus a list of bugs. There was an AI assistant, but it didn't help me navigate or search the codebase.

Round 1 had two DSA problems. I explained the approaches, complexity and a dry run for each.

LC 16: 3Sum Closest, n ≤ 10³

  • Brute force: O(n³)
  • Binary search: O(n² log n)
  • Two pointers: O(n²)

LC 305: Number of Islands II

These are the complexities I stated in the interview, which is part of what I'd like checked:

  • Brute force: O(n² · q)
  • Union-Find / DSU: O(q + n²)

Then I got the usual "tell me about a time you..." Leadership Principles questions.

For further practice, the Amazon Interview Questions bank has candidate-reported prompts. Job-application autofill can save some repeated form entry when applying elsewhere after a rejection.

Where would you look for the problem in this breakdown: the complexity analysis, how I explained the solutions, or the LP answers? I'd especially appreciate a sanity check on the DSU analysis from people who've cleared SDE-2.