We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
// Let say x is the number of days. After x days:
// samSolved = difference + x*samDaily
// kellySolved = x*kellyDaily
// x*kellyDaily > difference + x*samDaily
// x > difference/(kellyDaily - samDaily)
if (kellyDaily <= samDaily)
{
return -1;
}
return difference/(kellyDaily - samDaily) + 1;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Coding Friends
You are viewing a single comment's thread. Return to all comments →
// Let say x is the number of days. After x days: // samSolved = difference + x*samDaily // kellySolved = x*kellyDaily // x*kellyDaily > difference + x*samDaily // x > difference/(kellyDaily - samDaily) if (kellyDaily <= samDaily) { return -1; } return difference/(kellyDaily - samDaily) + 1;