• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
December 18, 2023 |1.5K Views
PROBLEM OF THE DAY : 17/12/2023 | Max Sum without Adjacents
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Siddharth Hazra. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Arrays but also build up problem-solving skills.

In this problem, given an array Arr of size N containing positive integers. Find the maximum sum of any possible subsequence such that no two numbers in the subsequence should be adjacent in Arr.

Example :

Input:
N = 6
Arr[] = {5, 5, 10, 100, 10, 5}
Output: 110

Explanation: If you take indices 0, 3 and 5, then Arr[0]+Arr[3]+Arr[5] =5+100+5 = 110.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/max-sum-without-adjacents2430/1