Ch-MANASA19 / Ch-MANASA19/Java

Maximum Sum of Non-Adjacent Elements

Aperta
#17 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
1
Fork
7
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

📋 Problem Description

Given an array of positive integers, find the maximum sum of elements such that no two selected elements are adjacent in the array.

You can only choose elements that are not next to each other. The goal is to maximize the total sum of chosen numbers.

Example 1

Input: nums = [3, 2, 7, 10]
Output: 13
Explanation: Choose elements 3 and 10 → sum = 13.

I WOUD LIKE TO WORK ON THIS

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by locating the Java source file where this basic program belongs; no file or test is named in the issue. Implement the maximum-sum behavior described for non-adjacent positive integers and verify it against the provided [3, 2, 7, 10] example, which should produce 13.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
backend
Tipo di issue
Funzionalità
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.