Tag Archives: Spoj solution FARIDA

Maximum sum with no adjacent elements

Maximum sum with no adjacent elements Maximum Sum with no adjacent elements Problem Statement: Given an array of positive numbers, find the maximum sum possible choosing numbers such that no two chosen numbers should be adjacent. Maximum Sum with no adjacent elements Problem Example: arr[ ] = {9, 1, 10, 100} Here maximum sum would be:… Read More »

Spoj FARIDA solution

Spoj FARIDA solution. Spoj Princess Farida solution Category : Dynamic Programming This question is very basic DP question, where we need to maximise the number of candies collected. Recursion for DP: dp[i]= max( dp[i-1], dp[i-2] +Val[i]) where dp[i] is the state of DP that stores the maximum number of candies that can be collected till… Read More »