Jump to content


Welcome to BrainDen.com - Brain Teasers Forum

Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account.
As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends.

Of course, you can also enjoy our collection of amazing optical illusions and cool math games.

If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top.
If you have a website, we would appreciate a little link to BrainDen.

Thanks and enjoy the Den :-)
Guest Message by DevFuse
 

Photo
- - - - -

A Child and a Staircase


  • Please log in to reply
15 replies to this topic

#11 Rockmond

Rockmond

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 21 June 2012 - 05:21 PM

I have a clarification question. If there are 10 steps and a landing at the bottom and the top, the child would have to take 11 steps if taken one at a time, right?
  • 0

#12 jim

jim

    Junior Member

  • Members
  • PipPip
  • 33 posts

Posted 22 June 2012 - 01:38 AM

442.
Since we can solve this with either Fibonacii numbers or combinations, we can conclude that
F10 = C(10,0) + C(9.1)+ ...+c(5.5).

More generally Fn = C(n,0) + C(n-1.1) + C(n-2,2) + ... as long as the first number is no les than the second.

NOTE If you interpet the question to mean 10 steps plus the upper landing the answer would be F11, a point one poster raised. In addition if we distinquish between first strride right foot and first stride left we would double our answer.
  • 0

#13 bonanova

bonanova

    bonanova

  • Moderator
  • PipPipPipPip
  • 5573 posts
  • Gender:Male
  • Location:New York

Posted 22 June 2012 - 04:56 AM

Congrats to witzar! I just counted them.
  • 0
The greatest challenge to any thinker is stating the problem in a way that will allow a solution.
- Bertrand Russell

#14 ujjagrawal

ujjagrawal

    Junior Member

  • Members
  • PipPip
  • 67 posts
  • Gender:Male
  • Location:India

Posted 22 June 2012 - 05:36 AM

Solved. Congrats to all of you who got it correct.

Spoiler for Spoiler for answer

  • 0

#15 wilbloodworth

wilbloodworth

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 06 January 2013 - 05:27 PM

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

#16 wolfgang

wolfgang

    Senior Member

  • Members
  • PipPipPipPip
  • 757 posts
  • Gender:Male

Posted 06 January 2013 - 06:31 PM

Spoiler for I think...they should be


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users