• + 1 comment

    Wrote a solution like this:

     const total = n * m;
      let newTotal = 0;
      let support = 0;
      support = Math.floor(n/2) * Math.floor(m/2);
      newTotal = total - support * 4;
      if(newTotal % 2 === 0){
        return support + newTotal / 2;
      }else{
        return support + Math.floor(newTotal / 2 )+ 1
      }
    

    Then found a solution like this :,)

    let x = Math.ceil(n/2)
    let y = Math.ceil(m/2)
    return x*y;