Hello, I would like advice on this codingame puzzle.

(sum of odd), I find the solutions well, but in too long a time. I wouldn’t like to have the solution, but knowing where to look if it’s more Mathematical (formula) or Algorithmic is how to optimize this one.

codingame exo: Coding Games and Programming Challenges to Code Better

my code: Sum of odd · GitHub

Sincerely, Maxime