Misère Nim

  • + 0 comments

    I believe the testcases's result is incorrect.

    My solution:

    public static string misereNim(List<int> s)
    {
        var pileOfOneCount = s.Count(x => x == 1);
        var pileOfOtherCount = s.Count(x => x > 1);
    
        if (pileOfOtherCount == 0)
        {
            return pileOfOneCount % 2 == 0 ? "First" : "Second";
        }
    
        return pileOfOtherCount % 2 == 0 ? "Second" : "First";
    }