Skip to content

Solution/march madness and cherry blossoms#15

Open
sh3rqxs wants to merge 2 commits intocodedex-io:mainfrom
sh3rqxs:solution/march-madness-and-cherry-blossoms
Open

Solution/march madness and cherry blossoms#15
sh3rqxs wants to merge 2 commits intocodedex-io:mainfrom
sh3rqxs:solution/march-madness-and-cherry-blossoms

Conversation

@sh3rqxs
Copy link
Contributor

@sh3rqxs sh3rqxs commented Mar 21, 2026

Hii, here are my JS solutions for March Madness and Cherry Blossoms!

My approaches for each challenge:

  1. March Madness 🏀:

    • Defined a new array called upset to contain the probability results of each match.
    • Named each array from matchups as match.
    • Represented the index 1 and 3 from match as seedA and seedB.
    • Calculated the upset probabilities of each match using: upset probability = higher seed / (higher seed + lower seed).
    • Rounded the results to two decimals places and pushed them to upset.
  2. Cherry Blossoms 🌸:

    • Initialized bloomDay = -1.
    • Looped through the array starting at index 4 (day 5).
    • Calculated the sum of temps[i-4] through temps[i] for each index i.
    • Computed the average as sum / 5.
    • Immediately returned i + 1 (1‑indexed day) if the average was ≥ 15.
    • Returned -1 if the loop finished without finding a bloom.

Let me know is there anything to fix!
shercodes 💖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant