ya nitish above condition will do
On 7/20/11, Nitish Garg nitishgarg1...@gmail.com wrote:
I think:
s[i] = max(s[i-2], s[i-2]+a[i], s[i-1], a[i]) should satisfy all the cases,
even when all the numbers are negative.
Pleas check.
On Wed, Jul 20, 2011 at 12:44 AM, pnandy
do both s[i-2] and s[i-1] need to be checked? isn't by construction
s[i-1]=s[i-2] ? what about s[i] = max( s[i-2]+a[i], s[i-1], a[i]) ?
On Wed, Jul 20, 2011 at 3:48 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
ya nitish above condition will do
On 7/20/11, Nitish Garg
On Jul 19, 8:00 pm, ankit sambyal ankitsamb...@gmail.com wrote:
@Nitish and Shubam : Since we trying to find sub sequence and not a
sub string, so if there are negative nos. in the array, just neglect
them.
Piyush's algo will work perfectly..
Piyush's algo won't work for -ve nos.
I think:
s[i] = max(s[i-2], s[i-2]+a[i], s[i-1], a[i]) should satisfy all the cases,
even when all the numbers are negative.
Pleas check.
On Wed, Jul 20, 2011 at 12:44 AM, pnandy sayantan.nand...@gmail.com wrote:
On Jul 19, 8:00 pm, ankit sambyal ankitsamb...@gmail.com wrote:
@Nitish and
@sunny. ..lol..dude..20 June is My Bro's B'day 18th Nov is of My
mom ...:P
Shashank
Computer Science Engg.
Birla Institute of Technology, Mesra
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
ans for 1st one is 24
On Sat, Nov 27, 2010 at 3:12 PM, vamsi achyuth vamsiachy...@gmail.comwrote:
these were the problems asked in tcs written exam.
On 27 November 2010 15:08, srinivas reddy srinivaseev...@gmail.comwrote:
@youngboy
you have to choose one value for variable only