Exercise tests timing out

Heyo, I’m getting the same issue on the Gleam track. I solved an exercise yesterday and everything worked fine, but today, for a different exercise, it’s giving me the time out error.

@deivpaukst Could you open a different issue please? The issues associated with JS are quite specific to that track. Please share the code that’s giving you the timeout and make sure it’s in the gleam category here, and we’ll take a look. Thanks :slight_smile:

Thank you for moving the issue!
The problem happened before at some point on a different exercise, but it seemed to just fix itself at some point so I didn’t report it, it’s now happened again.

Some specifics:
The exercise is Sum of Multiples
My code:

import gleam/list
import gleam/int

pub fn sum(factors factors: List(Int), limit limit: Int) -> Int {
  list_loop(factors, limit, [], 1)
}

fn list_loop(factors: List(Int), limit: Int, result: List(Int), count: Int) -> Int {
  case factors {
    [item, ..rest] if item * count < limit -> {
      list_loop([item, ..rest], limit, [item, ..result], count + 1)
    }
    [_, ..rest] -> {
      list_loop(rest, limit, result, 1)
    }
    _ -> result |> list.unique |> list.fold(from: 0, with: int.add)
  }
}

I did test it out in the Gleam Playground (calling the function with the values from the first test in the exercise) and it did compile and run successfully there.

1 Like

Hello! I’m still experiencing the issue. It’s keeping me from moving forward with more exercises. Well technically I could do other exercises, however I have a kind of mental barrier that’s preventing me from continuing without that exercise being complete.

My guess would be that your code is too slow to run on our infrastructure. How long does it take to complete locally?