class BaseConverter
def self.convert(input_base, digits, output_base)
result = 0
digit_count = digits.length
digits.each_with_index do |digit, index|
result += digit * input_base ** (digit_count - index - 1)
end
return [0] if result == 0
result_array = []
while result > 0
result_array.unshift(result % output_base)
result /= output_base
end
result_array
end
end
Test failure:
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.
Is it because of the while loop?