Skip to content

Glasgow | 26-SDC-Mar | Mohammed Abdoon | Sprint 1 | Analyse and Refactor Functions - #215

Open
M-Abdoon wants to merge 6 commits into
CodeYourFuture:mainfrom
M-Abdoon:sprint1
Open

Glasgow | 26-SDC-Mar | Mohammed Abdoon | Sprint 1 | Analyse and Refactor Functions#215
M-Abdoon wants to merge 6 commits into
CodeYourFuture:mainfrom
M-Abdoon:sprint1

Conversation

@M-Abdoon

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

@M-Abdoon M-Abdoon added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 15, 2026
@M-Abdoon M-Abdoon changed the title Glasgow | 26-SDC-March | Mohammed Abdoon| Sprint 1 | Analyse and Refactor Functions Glasgow | 26-SDC-Mar | Mohammed Abdoon| Sprint 1 | Analyse and Refactor Functions Jul 15, 2026
@M-Abdoon M-Abdoon added 📅 Sprint 1 Assigned during Sprint 1 of this module Module-Complexity The name of the module. labels Jul 15, 2026
@M-Abdoon M-Abdoon changed the title Glasgow | 26-SDC-Mar | Mohammed Abdoon| Sprint 1 | Analyse and Refactor Functions Glasgow | 26-SDC-Mar | Mohammed Abdoon | Sprint 1 | Analyse and Refactor Functions Jul 16, 2026
Comment on lines +22 to +24

// in this function, we need to use 2 loops to check if there is a pair of numbers that sum to the value.
// nothing can be optimized in this function, it is already efficient. No newline at end of file

@cjyuan cjyuan Jul 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • What's the complexity of the original code?

  • With a different algorithm, the complexity of the function could be reduced.

...new Set(firstArray.filter((item) => secondArray.includes(item))),
];

// the function does not need to be optimized as it is already efficient. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • What's the complexity of the original code?

  • The complexity of the function could be reduced.

Comment on lines +4 to +6
* Time Complexity: O(n)
* Space Complexity: O(n)
* Optimal Time Complexity: O(n)

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 also indicate the time complexity of the original code?

@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 Jul 17, 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. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants