Problem

3718. Smallest Missing Multiple of K

Logic

Code

class Solution {
public:
    int missingMultiple(vector<int>& nums, int k) {
        set<int> st(nums.begin(), nums.end());
        int length = st.size();
        
        for (int i = 1; i < 102; i++) {
            st.insert(k*i);
            if (st.size() != length) {
                return (k*i);
            }
        }

        return k;
    }
};