https://leetcode.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers/description/ Easy

Решение

class Solution {
    fun getNoZeroIntegers(n: Int): IntArray {
        fun hasZero(x0: Int): Boolean {
            var x = x0
            while (x > 0) {
                if (x % 10 == 0) return true
                x /= 10
            }
            return false
        }
        var a = 1
        while (a < n) {
            val b = n - a
            if (!hasZero(a) && !hasZero(b)) return intArrayOf(a, b)
            a++
        }
        return intArrayOf(1, n - 1)
    }
}