Skip to content

NW | 26-SDC-Mar | Zabihollah Namazi | Sprint 1 | Analyse and Refactor Functions#167

Open
ZabihollahNamazi wants to merge 10 commits into
CodeYourFuture:mainfrom
ZabihollahNamazi:sprint-1
Open

NW | 26-SDC-Mar | Zabihollah Namazi | Sprint 1 | Analyse and Refactor Functions#167
ZabihollahNamazi wants to merge 10 commits into
CodeYourFuture:mainfrom
ZabihollahNamazi:sprint-1

Conversation

@ZabihollahNamazi

Copy link
Copy Markdown

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

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

@ZabihollahNamazi ZabihollahNamazi added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Complexity The name of the module. labels Jun 13, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jun 13, 2026
@ZabihollahNamazi ZabihollahNamazi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 14, 2026
Comment thread Sprint-1/JavaScript/findCommonItems/findCommonItems.js Outdated
Comment thread Sprint-1/JavaScript/findCommonItems/findCommonItems.js Outdated
Comment thread Sprint-1/Python/find_common_items/find_common_items.py Outdated
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks ☺️

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you answer the question?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to try with something different rather than using same thing as I used in js

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you find out why the approach I mentioned won't work?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH the one I wrote before and then one you mentioned they both work.
I run the test and it worked.
Thanks

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 14, 2026
@ZabihollahNamazi ZabihollahNamazi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 14, 2026
@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Complexity The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants