Skip to content

Conversation

@Faithy4444
Copy link

@Faithy4444 Faithy4444 commented Oct 24, 2025

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

@github-actions
Copy link

Your PR's title didn't contain a known region.

Please check the expected title format, and make sure your region is in the correct place and spelled correctly.

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).

@Faithy4444 Faithy4444 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 Oct 24, 2025
@github-actions
Copy link

Your PR's title didn't contain a known region.

Please check the expected title format, and make sure your region is in the correct place and spelled correctly.

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).

1 similar comment
@github-actions
Copy link

Your PR's title didn't contain a known region.

Please check the expected title format, and make sure your region is in the correct place and spelled correctly.

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).

@Faithy4444 Faithy4444 changed the title Cape Town-ZA | Faith Muzondo | Module-Complexity | Sprint 1 | Analyse and refactor ZA | Faith Muzondo | Module-Complexity | Sprint 1 | Analyse and refactor Oct 25, 2025
@github-actions
Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

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).

* Time Complexity:
* Space Complexity:
* Optimal Time Complexity:
* Time Complexity:O(2n) originally have this as using 2 separate loops
Copy link

Choose a reason for hiding this comment

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

In complexity analysis, O(2n) is the same as O(n); the constant factor is ignored.


for (const item of firstArray) {
if (setB.has(item)) {
common.add(item);
Copy link

Choose a reason for hiding this comment

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

It's usually faster to append an element to an array than adding an item to a set even though both operations are O(1).

* Time Complexity:
* Space Complexity:
* Optimal Time Complexity:
* Time Complexity: O(n) — the function iterates through the input sequence once
Copy link

Choose a reason for hiding this comment

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

In the original code, the inner loop would iterate through uniqueItems[]. The complexity is more than O(n).

@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 Jan 23, 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