r/programming • u/svpino • May 08 '15
Five programming problems every Software Engineer should be able to solve in less than 1 hour
https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
2.5k
Upvotes
1
u/leeeeeer May 09 '15
Ha, that looks better! Didn't think about filling the string from the start.
Although turns out the 30s time I said is plain wrong, I was actually testing out Twister at the same time and forgot my CPU was trying to mine a block :p
By curiosity I ran the two functions side by side and measured the performance difference and they ran pretty much as fast, although mine was a little ~10ms faster in average. That surprised me since it seems less efficient at first with the greater number of string operations, but I think it comes from the function calls to splice being way more expensive than even a large number of basic string concatenations using +.