Two players take turns choosing an unused integer from 1 to maxChoosable and adding it to a running total that starts at 0. The player whose choice makes the total reach desiredTotal or more wins. Write canIWin(maxChoosable, desiredTotal): does the player who moves first win with perfect play from both sides?
- An integer, once chosen, cannot be chosen again by either player
maxChoosable is at most 20- If
desiredTotal is 0 or less, the first player has already won. If even taking every number cannot reach the total, nobody wins, so return false