[algogeeks] Re: Microsoft - DP problem

2011-01-20 Thread juver++
dp[i][flag] - max amount up to the i-th house (i-th house is included into final result if flag = true). -- 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

[algogeeks] Re: Microsoft - DP problem

2011-01-20 Thread Davin
static int MaxLoot(int[] A, int n) { int[] S = new int[n]; S[0] = A[0]; S[1] = A[1]; S[2] = S[0] + A[2]; int maxloot = Math.Max(S[1], S[2]); for (int i = 3; i n; i++) { S[i] =

Re: [algogeeks] Re: Microsoft - DP problem

2011-01-20 Thread Avi Dullu
@^ Just check ur solution for boundary case ( n = 2) .. M$ is *generally* very strict about such mistakes :) Programmers should realize their critical importance and responsibility in a world gone digital. They are in many ways similar to the priests and monks of Europe's Dark Ages; they are the

Re: [algogeeks] Re: Microsoft - DP problem

2011-01-20 Thread Manmeet Singh
I dnt get the iterative version. Can u explain it. I can do it top down in O(n) with state index I am at. On Thu, Jan 20, 2011 at 11:30 PM, Avi Dullu avi.du...@gmail.com wrote: @^ Just check ur solution for boundary case ( n = 2) .. M$ is *generally* very strict about such mistakes :)