Skip to content

London | 26-SDC-Mar | beko | Sprint 1 | analyse and refactor functions#173

Open
Abubakar-Meigag wants to merge 1 commit into
CodeYourFuture:mainfrom
Abubakar-Meigag:beko-complexity-sprint-1
Open

London | 26-SDC-Mar | beko | Sprint 1 | analyse and refactor functions#173
Abubakar-Meigag wants to merge 1 commit into
CodeYourFuture:mainfrom
Abubakar-Meigag:beko-complexity-sprint-1

Conversation

@Abubakar-Meigag

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

Complete analyse and refactor functions sprint 1 for Complexity

@Abubakar-Meigag Abubakar-Meigag added 📅 Sprint 1 Assigned during Sprint 1 of this module 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 24, 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.

Complexity analysis and code are good. Well done.

Comment on lines +12 to +17
export const findCommonItems = (firstArray, secondArray) => {
let second = new Set(secondArray)
return [ ...new Set(firstArray.filter((item) => second.has(item))) ]
}
console.log(findCommonItems([1, 2, 2, 3], [4, 3, 2]))

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: A set data structure typically supports set operations such as union, intersect, etc. You could also explore using these methods to simplify your solution.

Comment on lines +15 to +20
for(let i=0; i < numbers.length; i++){
let num = target - numbers[i]
if(checkPoint.has(num)){
return true
}else {
checkPoint.add(numbers[i])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The formatting of the code is not quite consistent.

More importantly, have you installed the prettier VSCode extension and enabled "Format on save/paste" on VSCode?
See https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md for more info.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jun 24, 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. Module-Complexity The name of the module. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants