We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
it's simply checking the last item of the vector/array.
Sorry, something went wrong.
thanks a lot, I was stuck on why you always add a coin in the end.
No branches or pull requests
}
whats the logic behing "nc-1 == i"
thanks
The text was updated successfully, but these errors were encountered: