Coding Problem Splitter

swift, function, algorithms – Feb 02 2021

Twitter posting that suggested most candidates could not solve this particular problem. This post just walks through the example posting, along with a solution written in Swift.

• • •


Coding Challenge

Not a fan of coding challenges, but this one looked interesting. I gave myself 25 minutes to figure it out and it took me about 25 minutes to come up with a solution.

My first couple of attempts where trying to be too clever. I just came to the conclusion that I should be writing it out in a simple way with comments.

coding challenge in swift


The solution gist is not the cleanest but I don’t mind it. May not be the most swifty way of doing this but it’s straightforward to read. You can see where the logic goes and nothing is hidden.

Follow on Twitter
Follow on Github