Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

FARIDA SPOJ WA Please help

$
0
0

Can someone please point out a corner case? I have created a separate array S, where I store the max sum up till a number A[i], with A[i] included. Therefore, my logical statement becomes S[i] = max(A[i] + S[i-2], A[i] + S[i-1])

In the end, I see which of S[i] and S[i-1] is bigger.

Problem - http://www.spoj.com/problems/FARIDA/ Code - http://ideone.com/F2BSGX


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>