The DP solution is to mark the winning position as winning. Then mark
any positions which can move to a winning position as losing and the
rest as winning.

On Jan 16, 12:21 pm, siva <sivavikne...@gmail.com> wrote:
> Ya I'm aware, Just wanted to confirm. Suppose if the problem can't be
> reduced to a mathematical formulae , then DP must be the reliable solution
> for this kind of problems.
> That's why wanted to know exact DP solution also..
>
>
>
>
>
>
>
> On Wednesday, 16 January 2013 22:42:52 UTC+5:30, Don wrote:
>
> > Sure, but why? The solution is n%3. DP will by more complex and
> > slower.
>
> > On Jan 16, 11:43 am, siva <sivavikne...@gmail.com> wrote:
> > > Thanks all for solutions, but this problem can also be solved using DP
> > > right ???
>
> > > On Wednesday, 16 January 2013 01:57:26 UTC+5:30, Don wrote:
>
> > > > Sprague–Grundy theorem
>
> > > > On Jan 12, 6:28 pm, Nguyễn Thành Danh <danhnguyen0...@gmail.com>
> > > > wrote:
> > > > > Can you please explain by which theorem you use to find out that?
>
> > > > > On Sat, Jan 12, 2013 at 11:41 AM, Lucifer <sourabhd2...@gmail.com>
> > > > wrote:
> > > > > > if (n%3 == 0)
> > > > > >       "Player 1 will lose"
> > > > > > else
> > > > > >       "Player 1 will win. The no. of balls picked in the first
> > turn
> > > > will
> > > > > > be n%3"

-- 


Reply via email to