292. Nim 游戏

292. Nim 游戏

292. Nim 游戏

Table of Contents

1 题目

2 代码

class Solution {

    /**
     * @param Integer $n
     * @return Boolean
     */
    function canWinNim($n) {
        return $n%4 != 0;
    }
}

3 思路

这个看答案了

看一下这个讲解 https://leetcode-cn.com/problems/nim-game/solution/java-bu-jiang-qi-yin-qiao-ji-zhi-shuo-kuang-jia-xi/

其中包括

  • 递归
  • 记忆化搜索
  • 从输出中查找规律

===

作者: 吴丹阳 https://www.cnblogs.com/wudanyang

更新时间: 2020-09-14 Mon 13:32

Emacs 28.0.50 (Org mode 9.3.7)

===

天行健,君子以自强不息。

地势坤,君子以厚德载物。

===

原文地址:https://www.cnblogs.com/wudanyang/p/13666163.html