• + 2 comments

    This was my solution in Swift

    import Foundation
    
    // Complete the beautifulDays function below.
    func beautifulDays(i: Int, j: Int, k: Int) -> Int {
        var count = 0
    
        for value in i...j {
            var r = value
            var q = 0
            while r > 0 {
                q = q * 10 + r % 10
                r /= 10
            }
            abs(value - q) % k == 0 ? count += 1 : ()
        }
        return count
    }