• + 0 comments
    static String isSatisfiable(int c1, int c2, int h1, int h2){
        //checking the initial condition for atleast and atmost    
            if((c1>=35) && (c2>=35) &&(h1<=95) && (h2<=95))
                {
                //checking the minimum temperature with max temperature
                if(h1>=c1 && h2>=c2)
                    {
                    //checking if atmost of 2nd temperature is less than atleast of 1st temperature . If so return "no"
                      if(h2<c1)
                          {
                          return "NO";
                      }
                    //checking if atmost of 1st temperature is less than atleast of 2nd temperature. If so return "no"
                    else if(h1<c2)
                        {
                        return "NO";
                    }
                    //if it satisfies all the condition . return "yes"
                    else
                        {
                    return "YES";
                    }
                
                }
                //if it fails with min temperature comparison with max temp return "no"
                else
                    {
                    return "NO";
                }
                
            }
            //if it fails the basic condition return "no"
            else 
                return "NO";
         
        }