• + 0 comments

    C#

    static int getMoneySpent(int[] keyboards, int[] drives, int b) {

         int temp =-1;
         foreach(var keyboard in keyboards){
            foreach(var drive in drives){
                if((keyboard + drive) > temp && (keyboard + drive) <=  b)
                temp = keyboard + drive;
            }
    
    
         }
         return temp;
    }