Blind 75 — Vámonos Recio.
I’m a senior at Oregon State University and I am on track to graduate after next term (Spring 2026). Obviously, like everyone else, I am…
Blind 75 — Vámonos Recio.
I’m a senior at Oregon State University and I am on track to graduate after next term (Spring 2026). Obviously, like everyone else, I am trying to figure out how to get better at pretty much everything: programming, designing, solving leetcode style problems, etc…
For the challenge of getting better at solving leetcode style problems, I decided to go ahead with neetcode instead of leetcode. For me this felt like a Coke vs Pepsi type of question and I personally like both; its trivial.
I just finished my first question from the Blind 75: hasDuplicate. It was pretty easy and quick to solve. Before I moved on to the next, I remembered something a classmate had mentioned to me. She had said that someone in the industry recommended her to write up a blog post explaining her reasoning for each leetcode question she solved. Something about that it will help strengthen the learning and also improve her ability to communicate. This sounds like a good idea so I am going to go ahead and do that. Consider this my first ‘blog post’.
Question: hasduplicate
My Solution:
def hasDuplicate(self, nums: List[int]) -> bool:
m = set()
for num in nums:
if num in m:
return True
m.add(num)
return False
My Reasoning:
Checking for membership in a set in python is an O(1) operation. Therefore, if we iterate through the list of integers, checking for membership in a set, then subsequently adding that integer to the set, the time complexity remains O(n). There’s no getting around O(n) when we need to check each number in the given list.
메타데이터
- post_id
- 20ef39fe98a0
- slug
- blind-75-vámonos-recio-20ef39fe98a0
- url
- https://medium.com/@raulp93/blind-75-v%C3%A1monos-recio-20ef39fe98a0
- canonical_url
- https://medium.com/@raulp93/blind-75-v%C3%A1monos-recio-20ef39fe98a0
- author_url
- https://medium.com/@raulp93
- status
- ok
- fetched_at
- 2026-06-26 21:52:29