I don't pass 3 args to gcd, it's an initial value in reduce function. There is a formula that relates an lcm through the gcd, so you don't need to use factorisation. But using reduce for making a string from an array was a bad decision - to many string concatenations. Map and join are much more efficient, especially with template strings.
I don't pass 3 args to gcd, it's an initial value in reduce function. There is a formula that relates an lcm through the gcd, so you don't need to use factorisation. But using reduce for making a string from an array was a bad decision - to many string concatenations. Map and join are much more efficient, especially with template strings.
puts
the input and try to figure out what could be wrong with that, for starters. If it does not ring a bell, tell me more about it.