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.
I like it
I think this is a more general solution to process string vs using "replace"
Can anyone explain me how come empty arrays are removed at second and beyond level, please? Because "[] as? [Any] -> []", it's not nil to be removed by flatMap.
Empty arrays are not in the challenge. That said, it was an interesting challenge to address.
The reason some are removed is the flattening logic removes and second level and beyond empty arrays.
To remove the first level empty arrays, add a filter to the return value:
.filter { !(($0 as? Array<Any>)?.isEmpty ?? false) }
neat like a groom's bow tie
This comment is hidden because it contains spoiler information about the solution
funny factorial )
This comment is hidden because it contains spoiler information about the solution
looks awesome! I would appreciate if you shared the name of that function/solution if there is one. thanks in advance
thanks, i learn something new from this. It's my first time to use a sequence function with defer inside.
Why difference * 2?
beautiful
String(num).compactMap { Int(String($0)) }.reversed() in new version of Swift
Nice.
not sure if recursion is the best approach here, since you do
abs
each time, although it will be a valid value after the first executionLoading more items...