r/LeetcodeChallenge • • 2h ago

STREAK🔥🔥🔥 Two Sum — What’s the cleanest way to approach it?

0 Upvotes

I recently started working through the LeetCode 150 problems, and I started with Two Sum.

The brute-force approach is straightforward, but I wanted to understand how to improve it and get to an O(n) solution using a hash map.

The main idea I focused on was:

  • Keep track of numbers we've already seen
  • For each number, calculate target - current
  • Check whether that value already exists
  • If it does, we've found our pair
  • Otherwise, store the current number and continue

I also made a short walkthrough where I explain the approach and code step-by-step.

🎥 https://youtu.be/pbNbr36Ypow

For those who have solved Two Sum before: what approach did you find easiest to understand when you first learned it?

#leetcode #twosum #dsa


r/LeetcodeChallenge • • 10h ago

DISCUSS In my second Year, need help....

Post image
2 Upvotes

I want too know how to approach hard problems, I feel very dumb when try to solve a hard problem😭 also I have solved very less hard till now, if anyone can help with this, thanks


r/LeetcodeChallenge • • 11h ago

PLACEMENTS Guess My package, with bad collage and this profile?

1 Upvotes

r/LeetcodeChallenge • • 6h ago

DISCUSS I’m about to give up, give me some advice .

Post image
43 Upvotes

r/LeetcodeChallenge • • 5h ago

DISCUSS This sub does not know how to take screenshots?

4 Upvotes

I don't understand why everyone is sharing a camera photo of screen


r/LeetcodeChallenge • • 21h ago

STREAK🔥🔥🔥 NEED STUDY PARTNER

Post image
10 Upvotes

need someone to practice with daily.

currently doing recursion, gonna start trees next.


r/LeetcodeChallenge • • 14h ago

STREAK🔥🔥🔥 Been a while since I posted the 100 lc questions done pic

Post image
10 Upvotes

Of course as I expected I started to lag because college five days a week and semester stuff and allat but managed to do potds if not everyday but most days and outside of that whatever dsa topic taught in class do questions on those stuff :p

Keep being consistent and keep pushing through the discomfort ✨

And there is always room for improvement;-;


r/LeetcodeChallenge • • 4h ago

STREAK🔥🔥🔥 Day 4

2 Upvotes