id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > halloweenWitches
prev  |  next  |  chance

Write a method called halloweenWitches that returns true if the good witches can defeat the bad witches. Each good witch can defeat two bad witches as long as at least one of the good witches only has to fight one bad witch. As an example, 5 good witches cannot defeat 10 bad witches, even though each good witch can defeat two bad ones because that would require every good witch to defeat two bad ones. At least one of the good ones should not have to fight two bad ones! Notice that 5 good witches CAN defeat 9 bad witches since one of the good witches only has to battle one bad witch. Look at the test data for further examples. Both input parameters will be non-negative.


halloweenWitches(5, 10) → false
halloweenWitches(5, 9) → true
halloweenWitches(200, 3) → true

...Save, Compile, Run (ctrl-enter)

public boolean halloweenWitches(int goodWitch, int badWitch) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy