NW | 26-SDC-Mar | Zabihollah Namazi | Sprint 1 | Analyse and Refactor Functions#167
Open
ZabihollahNamazi wants to merge 10 commits into
Open
NW | 26-SDC-Mar | Zabihollah Namazi | Sprint 1 | Analyse and Refactor Functions#167ZabihollahNamazi wants to merge 10 commits into
ZabihollahNamazi wants to merge 10 commits into
Conversation
3 tasks
cjyuan
reviewed
Jun 13, 2026
cjyuan
left a comment
There was a problem hiding this comment.
For each function defined in the file, can you explain the complexity using Big O notation?
- Time Complexity -> for the original function
- Space Complexity: -> for the function you improved
- Optimal Time Complexity -> for the function you improved
cjyuan
reviewed
Jun 14, 2026
Comment on lines
17
to
21
| for value in values: | ||
| is_duplicate = False | ||
| for existing in unique_items: | ||
| if value == existing: | ||
| is_duplicate = True | ||
| break | ||
| if not is_duplicate: | ||
|
|
||
| if value not in seen: | ||
| seen.add(value) | ||
| unique_items.append(value) |
There was a problem hiding this comment.
Why not just convert the given list to a set (to remove duplicates) and then convert the set back to a list, like what you did in your JS implementation?
Author
There was a problem hiding this comment.
I just wanted to try with something different rather than using same thing as I used in js
There was a problem hiding this comment.
Could you find out why the approach I mentioned won't work?
Author
There was a problem hiding this comment.
TBH the one I wrote before and then one you mentioned they both work.
I run the test and it worked.
Thanks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Self checklist
Optimized both the Python and JavaScript code by replacing slow codes with faster and better codes making lookups instant and cutting execution times on massive datasets