Skip to content

Comments

Glasgow | 25-SDC-Nov | Nataliia Volkova | Sprint 1 | Big-O notation and refactoring#95

Open
Nataliia74 wants to merge 1 commit intoCodeYourFuture:mainfrom
Nataliia74:JS
Open

Glasgow | 25-SDC-Nov | Nataliia Volkova | Sprint 1 | Big-O notation and refactoring#95
Nataliia74 wants to merge 1 commit intoCodeYourFuture:mainfrom
Nataliia74:JS

Conversation

@Nataliia74
Copy link

@Nataliia74 Nataliia74 commented Feb 10, 2026

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
    I used to solve these tasks with a hash set(based on hash table logic, which is very fast in terms of time complexity) for constant-time lookups and processes each element once. In addition, for JS logic new Set also keeps ordering along with deduplication.

@Nataliia74 Nataliia74 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 10, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 10, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@Nataliia74 Nataliia74 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 10, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 10, 2026
@Nataliia74 Nataliia74 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 10, 2026
Copy link

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

I think in this exercise,
"Time Complexity" is supposed to be the complexity of the original code, and
"Optimal Time Complexity" is the complexity of the refactored code.

Can you also describe the complexity of the original code?

Comment on lines +17 to +18
let firstArr = new Set(firstArray);
let secondArr = new Set(secondArray);
Copy link

Choose a reason for hiding this comment

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

For variables that do not need to be reassigned a value, better practice is to declare them using const.

let firstArr = new Set(firstArray);
let secondArr = new Set(secondArray);

return [...firstArr].filter((arr) => secondArr.has(arr));
Copy link

Choose a reason for hiding this comment

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

Note: Set has a built-in method for finding common elements between two sets.

@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 Feb 19, 2026
@github-actions
Copy link

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

1 similar comment
@github-actions
Copy link

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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