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
22 changes: 22 additions & 0 deletions march-2026/3-19-march-madness/march_madness.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// March Madness 🏀
// shercodes

function upsetProbability(matchups) {
// Defines the array for upset.
let upset = [];

for (let i = 0; i < matchups.length; i++) {
let match = matchups[i];

// Determines the higher seed (seedA) and lower seed (seedB).
const seedA = match[1];
const seedB = match[3];

// Calculates the upset probability for each matchup.
const prob = seedA / (seedA + seedB);
const result = Number(prob.toFixed(2));
upset.push(result);
}

return upset;
};
27 changes: 27 additions & 0 deletions march-2026/3-20-cherry-blossoms/cherry_blossoms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Cherry Blossoms 🌸
// shercodes

function cherryBlossoms(temps) {
// Defines the variable for bloomDay.
let bloomDay = -1; // -1 when there's no bloom day.

for (let i = 4; i < temps.length; i++) {

// Adds the current number plus the 4 before it.
let sum = 0;
for (let j = i - 4; j <= i; j++) {
sum += temps[j];
}

// Calculates the 5-day average.
let avg = sum / 5;

// Compares if the average is greater or equal to 15.
if (avg >= 15) {
bloomDay = i + 1; // i + 1 when there's a bloom day.
return bloomDay;
}
}

return bloomDay;
};