#[Kotlin] Transpose - An error occurred while running your tests

6 messages · Page 1 of 1 (latest)

earnest totem
#

I ran my tests several time and with a time span of an hour but the tests won't run. I don't have an infinite loop and the code doesn't seem to be too complex. Could someone help?

limber falcon
#

The test won't run or it take a long time to run and time out?? Those are 2 different things
Since you mention infinite loop, I would hazaard a guess that it is second case.
Regardless, please give more info :

  1. if the test doesnt run, what kinda of error was given out
  2. post your code here so people can take a look. remember to use codeblock and not screenshot
earnest totem
#

There error I got

#

With this code:

object Transpose {

     fun transpose(input: List<String>): List<String> {
        val longestLength = input.map { it.length }.max()
        return List(longestLength) { index -> 
            input
                .map { it.padEnd(longestLength) }
                .map { it[index] }
                .joinToString(separator = "")
        }.map { it.trimEnd() }
    }
}
limber falcon
#

did it run in your local env?