-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
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
[C++] Competitive (LeetCode & SPOJ) #94
Conversation
@amanmehara Please review my PR |
@@ -0,0 +1,42 @@ | |||
// Copyright 2020 Avinash Trivedi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align the licence header correctly.
@@ -0,0 +1,60 @@ | |||
// Copyright 2020 Avinash Trivedi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align the licence header correctly.
} | ||
|
||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newline at end of file.
return sum; | ||
|
||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newline at end of file.
|
||
return ms; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add newline at end of file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amanmehara should i add extra line after line no 42
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Please have a look at https://github.com/amanmehara/programming/blob/master/CONTRIBUTING.md and make changes accordingly. |
@amanmehara I have done the changes . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trivediavinash The changes are good. 😃
Some minor comments.
I'll approve and merge after they are fixed.
@@ -0,0 +1,40 @@ | |||
// Copyright 2020 Avinash Trived |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your name is incorrect! 😛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amanmehara Yeah i corrected that 😃
fast | ||
|
||
intt n; | ||
cin >> n; | ||
intt a[n]; | ||
for (intt i = 0; i < n; i++) | ||
{ | ||
cin >> a[i]; | ||
} | ||
|
||
intt k; | ||
cin >> k; | ||
for (intt i = 0; i < k; i++) | ||
{ | ||
intt x, y; | ||
cin >> x >> y; | ||
intt sum = 0; | ||
for (intt i = x; i <= y; i++) | ||
{ | ||
sum += a[i]; | ||
} | ||
|
||
cout << sum << endl; | ||
} | ||
|
||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some comments explaining the steps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amanmehara Done with the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing! 🎉
I have added the new solutions in C++/competitive