Ad

Avoid casting to double.

Code
Diff
  • #include <algorithm>
    
    static bool willTheyMeet(
        int startHour1, int endHour1, 
        int startHour2, int endHour2
    ){
        return !(
            std::max(startHour1, endHour1) < std::min(startHour2, endHour2) ||
            std::min(startHour1, endHour1) > std::max(startHour2, endHour2)
        );
    };
    • #include <cmath>
    • #include <algorithm>
    • static bool willTheyMeet(
    • int startHour1,
    • int endHour1,
    • int startHour2,
    • int endHour2)
    • {
    • return !(
    • fmax(startHour1, endHour1) < fmin(startHour2, endHour2) ||
    • fmin(startHour1, endHour1) > fmax(startHour2, endHour2)
    • );
    • int startHour1, int endHour1,
    • int startHour2, int endHour2
    • ){
    • return !(
    • std::max(startHour1, endHour1) < std::min(startHour2, endHour2) ||
    • std::min(startHour1, endHour1) > std::max(startHour2, endHour2)
    • );
    • };