Today’s code challenge is about being cool.
A number is cool if it’s a multiple of 11 or if it is one more than a multiple of 11.
Return true if the given non-negative number is cool.
Try this before you look at my solution.
Seriously – try it yourself.
Okay – here is my solution.
Here is the Ternary Operator again with a modulus operator used twice making it another one-liner.
Either condition would make the number a multiple of 11 or one more than a multiple of 11.
You can view my solution at the IBM Swift Sandbox.