Pergunta de entrevista da empresa Meta

Max sum of non-adjacent value combination in an array.

Respostas da entrevista

Sigiloso

21 de fev. de 2013

dp[i] = max(dp[i-1],a[i]+dp[i-2])

Sigiloso

14 de out. de 2012

That is a standard DP. The sample problem of the online interviewstreet site (if you mean that with the pegs) is a simple backtracking problem doable in about 15-20 LOC. No mind-breaking stuff needed.