I am really struggling with this kata on codewars.com. I am a complete beginner so i don't want a solution but if some1 could just push me in the right direction.
"In this kata you get the start number and the end number of a region and should return the count of all numbers except numbers with a 5 in it. The start and the end number are both inclusive!
Examples:
1,9 -> 1,2,3,4,6,7,8,9 -> Result 8
4,17 -> 4,6,7,8,9,10,11,12,13,14,16,17 -> Result 12"
So, i tried this so far, but i don't know if there is a way to search for all numbers that have 5 in them. Is there a way to add a universal character search like we have "*" online ?
func dontGiveMeFive(_ start: Int, _ end: Int) -> Int {
var rez = 0
var ints = [String]()
for i in start...end {
if ints.contains("5") {
rez += 1
}
}
return rez
}
NOTE: Solving examples is not that hard, but problem occures when you take into account some numbers that are not divisible by 5. like 51,52,53....or 425980 :)