Max Sum in the Configuration | GFG Solution | Searching and Sorting
Vložit
- čas přidán 16. 05. 2021
- Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Question Statement:
1. Given an array, you have to find the max sum of i*A[i] where A[i] is the element at index i in the array.
2. The only operation allowed is to rotate(clock-wise or counter clock-wise) the array any number of times.
Topic: #Array #SearchingAndSorting
Used #DataStructure: #Array
#TimeComplexity: O(n)
#SpaceComplexity: O(1)
---------------------------------------------------------------
Similar Questions:
1. Maximize the Sum of arr[i]*i : • Maximize the sum of ar...
---------------------------------------------------------------
For detailed information and other exercises, VISIT: www.pepcoding.com
Have a look at our result: www.pepcoding.com/placements
Follow us on our FB page: / pepcoding
Follow us on Instagram: / pepcoding
Follow us on LinkedIn: / pepcoding-education
----------------------------------------------------------------
#Array #GeeksForGeeks #SearchingAndSorting
I only cmnt to some videos and this explanation made me do it
what an explanation , wow
just the correct amount of words used, no time wasted not a single sec
thanks
@Pepcoding Great explanation. I hv tried many other sources but they were directly giving the final expression without any the explanation and I wasn't able to understand then till now. Thank you fr this grt explanation.
best explaination of this ques on youtube
Your explanation made it look easy.
Great better than all folks who explained !
Beautiful explanation. I did the same thing considering that O(n) TC. But wasnt able to form the mathematical relation.
Wow...Amazing explanation ...!!
The Best Explanation
So good explanation. Thank you.
mind blowing . excellent explaination
my code have some issue please go through it
class Solution {
public:
long long max_sum(int a[], int n) {
long long sum=0;
long long s0= 0;
for(int i=0; i
Thanks didi, you explained it brilliantly and I couldn't find such an explanation elsewhere .. My best wishes to you!
really nice explanation. Finally, I get to know that how to approach such types of questions.
Glad it was helpful! and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
The explanation could not be any better, thank you soo much, and also there are not many videos on this problem on youtube.
Amazing explanation ma'am. Really got that insight.
Superb explanation ma'am 👏👏
amazing explanation ma'am .
Great Explanation!!!
nice one
very nice explanation
really well explained!!
Best explanation!!
absolutely gold explanation.
Great explanation.
Excellent !!
thanks
Thank you so much.
Thanks !
Wonderful explanation! Thanks
yeh sab interview ke time kese aaiga dimag me?
well explained!!
Nice video Ma'am
Best👌👌
Glad you loved it but for better experience and precisely arranged content.
visit - nados.pepcoding.com and sign up to NADOS.
Don't forget to follow us on Instagram instagram.com/pepcoding/
nice explanation mam
Thank yo so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Amazing
Mind blowing explanation..
Thank you so much and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
Thanks Mam, full concept is clear🤗🤗🤗🤗
Most welcome 😊
Keep learning.
And for better experience and well organised content visit nados.pepcoding.com
Thank you so much, mam.
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
If you like our efforts, we request a review
g.page/Pepcoding/review?rc
You can subscribe to our channel here
czcams.com/users/Pepcodingabout?view_as=subscriber
superb explanation
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
If you like our efforts, we request a review
g.page/Pepcoding/review?rc
You can subscribe to our channel here
czcams.com/users/Pepcodingabout?view_as=subscriber
Exact same as leetcode 396
excellent...plzzz mam continue making videos..it was really helpful
Sure. Keep learning, Keep growing and keep loving Pepcoding!😊
yeh sab interview ke time kese aaiga dimag me?
nice explanation
Thanks for liking Keep watching
like it giurll😂😂
Mam plz make video on : k maximum sum combination from two arrays
Thanks you mam for this video. Mam can you please clarify whether for SDE profile it is mandatory to know C++ or Java ? Python is not sufficient for cracking test , I am practicing with Python for DSA only? Mam please guide.....
NO BRO I THINK YOU SHOULD KNOW C++ OR JAVA AS THEY ARE MUCH FASTER AND OPTIMIZED AS COMOPARED TO PYTHON WHICH IS SLOW. BY THE WAY IN WHICH YEAR YOU ARE?
@@Sonsourav Final year that's why I am asking. I have less time to prepare for other language.
@@lettry5297 final year ending or starting?
@@Sonsourav final year ending
bhai seekh sakthe ho tho java seekh lo it will only take a week to get familiar with the syntax , java is easy , otherwise go with python
when you have time learn cpp
yeh sab interview ke time kese aaiga dimag me?
Can't we do s1=(s0+ sum of array)%n?
(A + B) mod C = (A mod C + B mod C)mod C
so by this property the last term would get removed ,but the (A mod C + B mod C)(our reqd answer) then again gets modulo by c ,so our S1 is affected and we get wrong answer
(●'◡'●) Thnakyou mam so much mam