Swift "time out" on reading data

Hi Codingame,

I suggest you change the method for reading data in the Swift “default code”:

(readLine()!).characters.split{$0 == " “}.map(String.init)
change for:
(readLine()!).componentsSeparatedByString(” ")

because the first one is too slow, and is causing “time out” in puzzles with many data. (for example: Stock Exchange Losses, example 5)

2 Likes

Thanks, I’ll have a look to it today.

Already reported here along with other language support issues in Dtock Exchange. Thanks for providing an alternative solution :wink:

Bug Fixed.