Maximum Non-Adjacent Chocolates

Asked at Cisco · Coding Questions · Difficulty: Medium · Last asked Jul 17, 2025

A row of jars holds chocolates; jar `i` holds `nums[i]` of them. You may take all the chocolates from some of the jars, but you must never take from two jars that sit next to each other. Find the largest total you can collect.

Loading the problem…