Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ contact_links:
- name: CYF Slack
url: codeyourfuture.slack.com
about: Come to #cyf-curriculum and chat
- name: CYF Tech Ed
url: https://github.com/orgs/CodeYourFuture/teams/mentors
about: CYF mentors on Github
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/pd-assignment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: PD Coursework
description: Assign a piece of PD coursework
title: "[PD] <title>"
labels: [PD, 🏝 Priority Stretch, 🐇 Size Small, 📅 Sprint 1]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to assign this coursework!
- type: input
attributes:
label: Coursework content
validations:
required: true
- type: input
attributes:
label: Estimated time in hours
description: (PD has max 4 per week total)
validations:
required: true
- type: textarea
attributes:
label: What is the purpose of this assignment?
description: Clearly explain the purpose of this assignment and how trainees can evaluate this.
validations:
required: true
- type: textarea
attributes:
label: How to submit
description: State in clear steps how a trainee can submit this assignment.
placeholder: |
Copy the Google doc to your own Google Drive
Complete the work assigned
When you are ready, move your document to your class Drive
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give more context

Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
- type: markdown
attributes:
value: |
**Thank you so much.**

Please now complete this ticket by filling in the options on the sidebar.

1. Update labels
- priority -- is this coursework key, mandatory, or stretch?
- size -- help trainees plan their time with rough estimation
2. Add to project backlog
- add to the project named the same as this repo
- fill in custom fields -- priority, size, hours, week -- to match this issue

Once your ticket is complete, you may like to check it out on the example project board attached to this repo.
This is so you understand how trainees will use your work.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Coursework
description: Assign a piece of coursework
name: Tech Ed Coursework
description: Assign a piece of technical coursework
title: "<title>"
labels: [Tech Ed, 🏕 Priority Mandatory, 🐂 Size Medium, 📅 Module 1]
labels: [Tech Ed, 🏕 Priority Mandatory, 🐂 Size Medium, 📅 Sprint 1]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to assign this coursework!
Thanks for taking the time to assign this coursework!

To support our trainees with planning and prioritising their own learning journey, we want our coursework assignments to be more informative.
To support our trainees with planning and prioritising their own learning journey, we want our coursework assignments to be more informative.
We don't just want to tell them what to do, we want to tell them stuff like:
- why we are doing it
- what it's "for" (problem-solving, debugging, etc)
- how long they should spend on it, maximum
- how to get help
- how to review it with answers
- how to get help
- how to review it with answers
- how to get it reviewed from mentors and peers
- type: input
attributes:
Expand All @@ -26,7 +26,7 @@ body:
label: Learning Objectives
description: https://common.codeyourfuture.io/common-theme/shortcodes/objectives/
placeholder: |
<!--{{<objectives}}-->
<!--{{<objectives}}-->
- [ ] CYF format, task list formatting
<!--{{</objectives}}-->
- type: textarea
Expand All @@ -38,6 +38,7 @@ body:
- type: input
attributes:
label: Maximum time in hours
description: (Tech has max 16 per week total)
validations:
required: true
- type: textarea
Expand Down Expand Up @@ -79,7 +80,7 @@ body:
1. Update labels
- priority -- is this coursework key, mandatory, or stretch? Pick one.
- size -- help trainees plan their time with rough estimation. Pick one
- topics -- add all that seem relevant to you.
- topics -- add all that seem relevant to you.
2. Add a Sprint label to add to the backlog view
- sprint 1,2,3,4

Expand Down
24 changes: 16 additions & 8 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@

You must title your PR like this:

REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
Region | Cohort | FirstName LastName | Sprint | Assignment Title

For example,

London | March-2025 | Carol Owen | Wireframe
London | 25-ITP-May | Carol Owen | Sprint 1 | Alarm Clock

Complete the task list below this message.
If your PR is rejected, check the task list.
Fill in the template below - remove any sections that don't apply.

Complete the self checklist - replace each empty box in the checklist [ ] with a [x].

Add the label "Needs Review" and you will get review.

Respond to volunteer reviews until the volunteer marks it as "Complete".

-->

## Learners, PR Template

Self checklist

- [ ] I have committed my files one by one, on purpose, and for a reason
- [ ] I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
- [ ] 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](https://curriculum.codeyourfuture.io/guides/reviewing/style-guide/)
- [ ] My changes meet the [requirements](./README.md) of this task

## Changelist

Briefly explain your PR.

## Questions

Ask any questions you have for your reviewer. Delete this section if there are none.
Ask any questions you have for your reviewer.
18 changes: 18 additions & 0 deletions .github/workflows/validate-pr-metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Validate PR Metadata
on:
pull_request_target:
types:
- labeled
- unlabeled
- opened
- edited
- reopened

jobs:
validate_pr_metadata:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: CodeYourFuture/actions/validate-pr-metadata@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,53 @@
* "product": 30 // 2 * 3 * 5
* }
*
* Time Complexity:
* Space Complexity:
* Optimal Time Complexity:
* Time Complexity: O(n) - Single pass through the array
* Space Complexity: O(1) - Only using constant extra space
* Optimal Time Complexity: O(n) - Cannot do better than linear time
*
* @param {Array<number>} numbers - Numbers to process
* @returns {Object} Object containing running total and product
*/
export function calculateSumAndProduct(numbers) {
let sum = 0;
for (const num of numbers) {
sum += num;
}
// OPTIMIZED IMPLEMENTATION: Single pass algorithm
// Previous implementation used two separate loops (2n operations)
// This version combines both calculations in one loop (n operations)

let sum = 0; // O(1) space
let product = 1; // O(1) space

let product = 1;
// Single pass through array: O(n) time complexity
for (const num of numbers) {
product *= num;
sum += num; // O(1) operation per element
product *= num; // O(1) operation per element
}

return {
sum: sum,
product: product,
};
// Return optimized object syntax: O(1) space
return { sum, product };
}

/*
* ORIGINAL IMPLEMENTATION (for comparison):
*
* export function calculateSumAndProduct(numbers) {
* let sum = 0;
* for (const num of numbers) { // First pass: O(n)
* sum += num;
* }
*
* let product = 1;
* for (const num of numbers) { // Second pass: O(n)
* product *= num;
* }
*
* return { // Total: O(2n) = O(n) time
* sum: sum, // O(1) space
* product: product,
* };
* }
*
* IMPROVEMENTS MADE:
* 1. Reduced from 2n to n operations (50% fewer iterations)
* 2. Better cache locality (single pass through memory)
* 3. Same O(n) time complexity but with better constant factors
*/
44 changes: 38 additions & 6 deletions Sprint-1/JavaScript/findCommonItems/findCommonItems.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
/**
* Finds common items between two arrays.
*
* Time Complexity:
* Space Complexity:
* Optimal Time Complexity:
* Time Complexity: O(n + m) - Single pass through both arrays
* Space Complexity: O(min(n, m)) - Set size bounded by smaller array
* Optimal Time Complexity: O(n + m) - Cannot do better than linear time
*
* @param {Array} firstArray - First array to compare
* @param {Array} secondArray - Second array to compare
* @returns {Array} Array containing unique common items
*/
export const findCommonItems = (firstArray, secondArray) => [
...new Set(firstArray.filter((item) => secondArray.includes(item))),
];
export const findCommonItems = (firstArray, secondArray) => {
// OPTIMIZED IMPLEMENTATION: O(n + m) time complexity
// Previous implementation: O(n × m) due to nested includes() calls

// Convert second array to Set for O(1) lookup: O(m) time, O(m) space
const secondSet = new Set(secondArray);

// Find common items using Set lookup: O(n) time
const commonItems = firstArray.filter((item) => secondSet.has(item));

// Remove duplicates: O(n) time in worst case
return [...new Set(commonItems)];
};

/*
* ORIGINAL IMPLEMENTATION (for comparison):
*
* export const findCommonItems = (firstArray, secondArray) => [
* ...new Set(firstArray.filter((item) => secondArray.includes(item))),
* ];
*
* COMPLEXITY ANALYSIS OF ORIGINAL:
* - firstArray.filter(): O(n) iterations
* - secondArray.includes(): O(m) for each iteration
* - Total: O(n × m) time complexity
* - Space: O(n) for Set creation
*

* IMPROVEMENTS MADE:
* 1. Reduced from O(n × m) to O(n + m) time complexity
* 2. Set lookup is O(1) vs Array.includes() O(m)
* 3. Significant performance gain for large arrays
* 4. Same functionality with better algorithmic efficiency

*/
54 changes: 46 additions & 8 deletions Sprint-1/JavaScript/hasPairWithSum/hasPairWithSum.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,59 @@
/**
* Find if there is a pair of numbers that sum to a given target value.
*
* Time Complexity:
* Space Complexity:
* Optimal Time Complexity:
* Time Complexity: O(n) - Single pass through the array
* Space Complexity: O(n) - Set to store seen numbers
* Optimal Time Complexity: O(n) - Cannot do better than linear time
*
* @param {Array<number>} numbers - Array of numbers to search through
* @param {number} target - Target sum to find
* @returns {boolean} True if pair exists, false otherwise
*/
export function hasPairWithSum(numbers, target) {
for (let i = 0; i < numbers.length; i++) {
for (let j = i + 1; j < numbers.length; j++) {
if (numbers[i] + numbers[j] === target) {
return true;
}
// OPTIMIZED IMPLEMENTATION: O(n) time complexity
// Previous implementation: O(n²) due to nested loops

const seen = new Set(); // O(n)

// O(n) time complexity
for (const num of numbers) {
const complement = target - num;
// O(1) lookup
if (seen.has(complement)) {
return true;
}

// O(1) operation
seen.add(num);
}
return false;
}
console.log(hasPairWithSum([3, 2, 3, 4, 5], 9));
/*
* ORIGINAL IMPLEMENTATION (for comparison):
*
* export function hasPairWithSum(numbers, target) {
* for (let i = 0; i < numbers.length; i++) { // O(n) iterations
* for (let j = i + 1; j < numbers.length; j++) { // O(n) iterations each
* if (numbers[i] + numbers[j] === target) { // O(1) comparison
* return true;
* }
* }
* }
* return false;
* }
*
* COMPLEXITY ANALYSIS OF ORIGINAL:
* - Outer loop: O(n) iterations
* - Inner loop: O(n) iterations for each outer iteration
* - Total: O(n²) time complexity
* - Space: O(1) - only using loop variables
*
* PERFORMANCE ISSUES:
* - Quadratic time complexity O(n²)
*
* IMPROVEMENTS MADE:
* 1. Reduced from O(n²) to O(n) time complexity
* 2. Single pass through array instead of nested loops
* 3. Set lookup is O(1) vs nested iteration O(n)
*/
12 changes: 12 additions & 0 deletions Sprint-1/JavaScript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading