wilbloodworth

Members
  • Content count

    1
  • Joined

  • Last visited


Community Reputation

0

About wilbloodworth

  • Rank
    Newbie

wilbloodworth's Activity

  1. wilbloodworth added an answer to a question A Child and a Staircase   

    I think 89 is correct. Here's a simple C# implementation that you can test out if you want to use LinqPad:


    void Main() { countWays(10).Dump(); } int countWays(int steps) { if (steps < 0) return 0; if (steps == 0) return 1; if (_map.ContainsKey(steps)) return _map[steps]; _map[steps] = countWays(steps - 1) + countWays(steps - 2); return _map[steps]; } private readonly Dictionary<int, int> _map = new Dictionary<int, int>();
    • 0