Hi, trying to run the tests in the web editor and get the following error
Your tests timed out. This might mean that there was an issue in our infrastructure, but more likely it suggests that your code is running slowly. Is there an infinite loop or something similar?
Please check your code, and if nothing seems to be wrong, try running the tests again.
The code I try to run is working in VS Code without problem, so not sure what's going on here. Any hint on what I'm doing wrong?
Function Invoke-CollatzConjecture() {
[CmdletBinding()]
Param(
[Int64]$Number
)
$Steps = 0
$Sequence = @($Number)
while ($Number -ne 1) {
switch ($Number % 2) {
0 {$Number = $Number / 2}
1 {$Number = $Number * 3 + 1}
}
$Sequence += $Number
$Steps ++
}
Write-Host "It took $Steps steps to reach 1.`nThe sequence was: $($Sequence -join ' โ ')"
# Throw "Please implement this function"
}