Sort by

recency

|

251 Discussions

|

  • + 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;
    
    • + 0 comments

      But isnt the answer for n=2, m=4 equals to 3 ? The solution gives 2

  • + 0 comments

    Not sure what I'm doing wrong.

    def gameWithCells(n, m):
        # Write your code here
        total_bases=n*m
        if n==1 or m==1:
            border_drops=total_bases//2
            base_drops=total_bases-2*border_drops
            total_drops=border_drops+base_drops
        else:
            corner_drops=total_bases//4
            border_drops=(total_bases-corner_drops*4)//2
            base_drops=total_bases-4*corner_drops-2*border_drops
            total_drops=corner_drops+border_drops+base_drops
            
        return total_drops
    
  • + 0 comments

    Looking to improve your research paper writing? Check out this comprehensive guide that will help you excel: Write research paper for expert tips and techniques!

  • + 0 comments

    Payday Loans eLoanWarehouse provides personal loans of up to $3000 in your account with quick approval, no credit check, and easy online application.

  • + 0 comments
    https://github.com/han023/Speed-Programming/blob/master/math%20theory/fundamentals/Army%20Game.py