acmcsufoss / lc-dailies

Daily Leetcode challenges for members to practice their algorithms.
https://acmcsuf.com/lc-dailies
MIT License
3 stars 0 forks source link

Add top scorers to daily webhook #32

Closed EthanThatOneKid closed 1 year ago

EthanThatOneKid commented 1 year ago

In every daily webhook from LC-Dailies, we need to include a version of the current season's leaderboard. However, on Sundays when the webhook is triggered, the leaderboard should display the results of the previous week. This is because there are no submissions for the new season at that point during the Sunday daily webhook.

EthanThatOneKid commented 1 year ago

The academic formula for scoring LC (LeetCode) Dailies submissions for an automated leaderboard sent weekly can be expressed as follows:

Let:

The formula for calculating the score for a submitted question can be defined as:

Score(t) = \begin{cases} 
  MaxPerQuestion & \text{if } t \leq 0 \\
  MaxPerQuestion - \frac{(MaxPerQuestion - MinPerQuestion) \cdot t}{TransitionTime} & \text{if } 0 < t \leq TransitionTime \\
  MinPerQuestion & \text{if } t > TransitionTime 
\end{cases}

Where:

Proof:

  1. When $t \leq 0$, the score should be equal to $MaxPerQuestion$ as no time has passed, and the participant should receive the maximum points available for that question. This aligns with the requirement that the maximum points for a season are divisible by 7.

  2. When $0 < t \leq TransitionTime$, the score decreases linearly from $MaxPerQuestion$ to $MinPerQuestion$ as time passes. The formula $MaxPerQuestion - \frac{(MaxPerQuestion - MinPerQuestion) \cdot t}{TransitionTime}$ represents a linear decrease in points over time. This encourages participants to submit answers promptly, as the longer they wait, the fewer points they will receive for that question.

  3. When $t > TransitionTime$, the score remains at $MinPerQuestion$ as the transition time has passed. This ensures that participants who submit very late still receive a minimum score for their effort.

  4. The requirement to round up and use whole numbers for the scores can be easily accommodated within this formula by applying standard rounding rules.

This formula provides a fair and incentivized scoring system for LC Dailies submissions, encouraging regular participation while allowing some flexibility for missed days. It's based on the specified maximum and minimum points per question and the transition time defined by the community.