bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 292. Nim Game

292. Nim Game

Leetcode Solutions

Winning the Nim Game by Avoiding Multiples of Four

  1. Check if the number of stones n is divisible by 4.
  2. If n is not divisible by 4, return true because you can win by taking the right number of stones to leave a multiple of four for your opponent.
  3. If n is divisible by 4, return false because no matter what you do, your opponent can always leave you with a multiple of four, leading to your loss.
UML Thumbnail

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...