Coding Friends

  • + 0 comments

    java 2 liner

    the delta for kelly has to be > 0, or she will never surpass

    the difference / delta are the required days

    adding 1 to difference to account for a day 0 case


    public static int minNum(int samDaily, int kellyDaily, int difference) {
        int kellyDelta = kellyDaily - samDaily;
        return kellyDelta <= 0 ? -1 : (int) Math.ceil((double) (difference + 1) / kellyDelta);
    }