• + 0 comments

    Here is my c++ solution, you can find the video here : https://youtu.be/yC-TXToDbD0

    int getMoneySpent(vector<int> keyboards, vector<int> drives, int b) {
        int ans = -1;
        for(int k : keyboards){
            for(int d : drives){
                if(k + d > ans && k + d <= b) ans = k + d;
            }
        }
        return ans;
    }