You are viewing a single comment's thread. Return to all comments →
Why would the input be in format of an array of strings in the Scala version? Given the limited availability of languages in the Recursion domain and how few people know any of the languages here, why not at least start us out with an Int argument?
Man, Scala is annoying.
Also, after the 13th iteration the compiler breaks and the output starts to invert. Try custom input with something like 20.
Had the same problem and adapted this from @saltybald below:
val n = io.Source.stdin.getLines.toList.map(.trim).map(.toInt).head
Not sure what is going on here, but it worked!
Works, but it's a bit too much work. For input as trivial as this, val n = readLine().toInt should suffice.
val n = readLine().toInt