about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 220
Copyright Nick Parlante 2017 - privacy