We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Game Theory
  4. Game of Stones
  5. Discussions

Game of Stones

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • tao_zhang
    7 years ago+ 1 comment

    This game is composed of the repeating group of LWWWWWL Therefore the solution in Java is like this --> System.out.println(scanner.nextInt()%7<2?"Second":"First");

    Source: https://www.cs.umd.edu/~gasarch/COURSES/250/S15/nimnotes.pdf

    7|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy