Skip to content

Question #2

Open
Open
@ptoledor

Description

@ptoledor
for(int i=0; i<nc; i++){
    if(**nc-1 == i** || curSum+coins[i] < coins[i+1]){
        curSum += coins[i];
        res++;
    }
}   
cout << res << endl;

}

whats the logic behing "nc-1 == i"
thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions