Sort by

recency

|

1285 Discussions

|

  • + 0 comments

    // JavaScript

    const catA = Math.abs(x - z);

    const catB = Math.abs(y - z);

    if( catA > catB ) {

    return Cat B;

    } else if (catB === catA) {

    return `Mouse C`;
    

    } else {

    return Cat A;

    }

  • + 0 comments

    If you’re self-employed, securing a mortgage can feel tricky because lenders often want more documentation than they do for salaried applicants. Working with a mortgage broker for self employed can simplify the process, as they understand which lenders are flexible with income verification and can guide you through the paperwork. They can help identify programs that suit your financial situation and maximize your approval chances. Additionally, a good broker can advise on interest rates, down payment options, and credit requirements. Overall, using a knowledgeable broker makes the mortgage process smoother and less stressful for self-employed individuals.

  • + 0 comments

    javascript solution

    function catAndMouse(x, y, z) {
      const catADistance = Math.abs(x - z);
      const catBDistance = Math.abs(y - z);
    
      return catADistance === catBDistance
        ? "Mouse C"
        : catADistance < catBDistance
          ? "Cat A"
          : "Cat B";
    }
    
  • + 0 comments
    // Complete the catAndMouse function below.
    func catAndMouse(x int32, y int32, z int32) string {
        var result = "Mouse C"
        catA := (z-x) 
        if catA < 0{
            catA  = -catA
        }
        catB := z-y
        if catB < 0{
            catB = -catB
        }
        if catA < catB {
            result = "Cat A"
        }
        if catA > catB {
             result = "Cat B"
        }
        return result
    }
    
  • + 0 comments

    Python solution

    def catAndMouse(x, y, z):
        cat_a = abs(z - x)
        cat_b = abs(z - y)
        
        if cat_a < cat_b:
            return "Cat A" 
        elif cat_a > cat_b:
            return "Cat B"
        else:
            return "Mouse C"