Maximum Chocolates from Jars (L.C. 198 :)

Problem Overview

  • Determine the maximum chocolates Andrew can collect by picking from jars such that no two chosen jars are adjacent.
  • Input: integer N and N space-separated integers for chocolates per jar; Output: one integer for the maximum; Constraint: 1 ≤ N ≤ 1000.
  • Real-world context: optimizing resource selection under adjacency restrictions.
  • This coding interview problem is a Cisco interviews interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: