Skip to content

Birmingham | 26-JUL-SDC |Merve Reis | Sprint 1 | Analyse and Refactor - #240

Open
mervereis wants to merge 11 commits into
CodeYourFuture:mainfrom
mervereis:sprint1-analyse-and-refactor-functions
Open

mervereis wants to merge 11 commits into
CodeYourFuture:mainfrom
mervereis:sprint1-analyse-and-refactor-functions

Conversation

@mervereis

@mervereis mervereis commented Oct 12, 2026 •

Copy link
Copy Markdown

Learners, PR Template

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

Task code

CYF-1173

Changelist

Refactored the Sprint 1 functions for clarity and maintainability across both JavaScript and Python implementations. Verified the existing tests still pass and the behavior remains correct.

@github-actions

This comment has been minimized.

@mervereis mervereis added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 12, 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.

Analyses and implementation are correct.

Comment on lines +29 to +33
for (const item of firstArray) {
if (secondSet.has(item)) {
commonItems.add(item);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note:
Most Set implementations support the common set operations such as union, intersection, difference, subset, superset, equality, add, remove, contains, size, clear, and is empty.
You could consider taking advantage of them for optimal performance.

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 for the suggestion! I used a Set to make lookups faster and avoid duplicate items. @cjyuan

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I am not sure if you got what I meant.

Could you show the code to compute the intersection of two sets, firstSet and secondSet, using their built-in methods?

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 for clarifying—I misunderstood your suggestion. I’ve updated the implementation to create firstSet and secondSet and use firstSet.intersection(secondSet) @cjyuan

Comment thread Sprint-1/JavaScript/removeDuplicates/removeDuplicates.mjs Outdated
Comment thread Sprint-1/Python/has_pair_with_sum/has_pair_with_sum.py
@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 Oct 13, 2026
@cjyuan

cjyuan commented Oct 15, 2026

Copy link
Copy Markdown

Changes look good.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants