• + 0 comments
    string solve(int n) {
         int i = 1;
    
        while (true) {
            // Convert i to binary string
            string binary = "";
            int temp = i;
            while (temp > 0) {
                binary = (temp % 2 == 0 ? '0' : '9') + binary;
                temp /= 2;
            }
    
            // Convert to integer and check divisibility
            long long candidate = stoll(binary);
            if (candidate % n == 0) {
                return binary;
            }
    
            i++;
        }
        
        return "";
    
    }