Is he gonna survive?

Lee·2022년 6월 9일

Algorithm

목록 보기
10/92
post-thumbnail

❓ Is he gonna survive?

Q. A hero is on his way to the castle to complete his mission. However, he's been told that the castle is surrounded with a couple of powerful dragons! each dragon takes 2 bullets to be defeated, our hero has no idea how many bullets he should carry.. Assuming he's gonna grab a specific given number of bullets and move forward to fight another specific given number of dragons, will he survive?

Return True if yes, False otherwise :)

✔ Solution

function hero(bullets, dragons){
//Get Coding!
  if(bullets >= dragons*2){
     return true
  }
  else{
    return false
  }
}
profile
Lee

0개의 댓글