Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
There weren't tests like that?! I just wasted time then.
Code here if you want to try:
His solution is actually much faster than mine for larger data sets and longer numbers. Benchmark testing on Repl.it given the following parameters:
10,000 strings of length
L
where 500 <=L
< 1,000string.to_i.digits.sum -- 21.563347 seconds
string.chars.sum(&:to_i) -- 3.311112 seconds
However, my solution is like 2 or 3 characters shorter so clearly mine is more efficient!
ja wäre am besten... Das sollte aber auch einfach nur ein test sein, um meinem lehrer zu zeigen, was man hier alles machen kann...
Nah, it's so simple. How is that so amazing? 🤣
I removed
list(
, which makes it shorter.