Electronics Shop

 https://www.hackerrank.com/challenges/electronics-shop/problem?h_r=profile

int getMoneySpent(vector<int> keyboards, vector<int> drives, int b) {
    int res=-1;
for(int i=0;i<keyboards.size();i++){
    for(int j=0;j<drives.size();j++){
        if((keyboards[i]+drives[j])>res && (keyboards[i]+drives[j])<=b){
            res=max(keyboards[i]+drives[j],res);
        }
    }
}
return res;

}

 

Comments

Popular posts from this blog

Perfect Peak of Array

Is Rectangle?

Sort array with squares!