Coding Friends

  • + 0 comments

    JAVA Solution:

    public static int minNum(int samDaily, int kellyDaily, int difference) {
        // Write your code here
        
        int samsolved = difference + samDaily;
        int kellysolved = kellyDaily;
        int count=1;
        
        if(kellyDaily==samDaily) return -1;
          
        while(samsolved-kellysolved>=0){
            samsolved=samsolved+samDaily;
            kellysolved=kellysolved+kellyDaily;
            count++;
        }
        return count;
        }