I think it's fibonacci series...
T(n)= T(n-1) + T(n-2)

Explanation:
T(n): no. of ways for n stairs

T(n-1): when it took the first step as 1 stair

t(n-2): when it took the first step as 2 stairs

the series can be started as
T(1)=1
T(2)=2
and calculate the rest from above

On Sat, Aug 13, 2011 at 8:37 PM, Gaurav Menghani
<gaurav.mengh...@gmail.com>wrote:

> Knapsack DP
>
> On Sat, Aug 13, 2011 at 8:35 PM, Kamakshii Aggarwal
> <kamakshi...@gmail.com> wrote:
> > yes
> >
> > On Sat, Aug 13, 2011 at 8:30 PM, Puneet Goyal <puneetgoya...@gmail.com>
> > wrote:
> >>
> >> 1 or 2 stairs?
> >>
> >> On Sat, Aug 13, 2011 at 8:24 PM, Kamakshii Aggarwal
> >> <kamakshi...@gmail.com> wrote:
> >>>
> >>> Given n stairs, how many number of ways can you climb if u use either 1
> >>> or 2 at a time?
> >>> --
> >>> Regards,
> >>> Kamakshi
> >>> kamakshi...@gmail.com
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >>
> >>
> >> --
> >> -----------------------------------------------------------------------
> >> Puneet Goyal
> >> Student of B. Tech. III Year (Software Engineering)
> >> Delhi Technological University, Delhi
> >> -----------------------------------------------------------------------
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/algogeeks?hl=en.
> >
> >
> >
> > --
> > Regards,
> > Kamakshi
> > kamakshi...@gmail.com
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
>
>
>
> --
> Gaurav Menghani
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
-----------------------------------------------------------------------
Puneet Goyal
Student of B. Tech. III Year (Software Engineering)
Delhi Technological University, Delhi
-----------------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to