Max Sum in the Configuration | GFG Solution | Searching and Sorting

Sdílet
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

Komentáře • 65

  • @himanshubani3744
    @himanshubani3744 Před 2 lety +4

    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

  • @gopireddyharshavardhanredd5209

    @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.

  • @kartikchauhan2778
    @kartikchauhan2778 Před 2 lety +2

    best explaination of this ques on youtube

  • @neocodes
    @neocodes Před rokem +1

    Your explanation made it look easy.

  • @NavneetKumar-fr9wj
    @NavneetKumar-fr9wj Před rokem +1

    Great better than all folks who explained !

  • @subhajitdey135
    @subhajitdey135 Před měsícem +1

    Beautiful explanation. I did the same thing considering that O(n) TC. But wasnt able to form the mathematical relation.

  • @ananthasubramanian7355
    @ananthasubramanian7355 Před rokem +1

    Wow...Amazing explanation ...!!

  • @lavishchittora2273
    @lavishchittora2273 Před rokem +1

    The Best Explanation

  • @vinayakseth353
    @vinayakseth353 Před rokem +1

    So good explanation. Thank you.

  • @swatirajshalu9268
    @swatirajshalu9268 Před měsícem +1

    mind blowing . excellent explaination

    • @SATYAMKUMAR-fe9ch
      @SATYAMKUMAR-fe9ch Před měsícem

      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

  • @adityamedhe
    @adityamedhe Před 2 lety +2

    Thanks didi, you explained it brilliantly and I couldn't find such an explanation elsewhere .. My best wishes to you!

  • @nirbhayparmar
    @nirbhayparmar Před 3 lety +5

    really nice explanation. Finally, I get to know that how to approach such types of questions.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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 )

  • @tusharnain6652
    @tusharnain6652 Před 2 lety +2

    The explanation could not be any better, thank you soo much, and also there are not many videos on this problem on youtube.

  • @angadrajsingh4311
    @angadrajsingh4311 Před 2 lety +4

    Amazing explanation ma'am. Really got that insight.

  • @hemanthbanoth8481
    @hemanthbanoth8481 Před rokem +1

    Superb explanation ma'am 👏👏

  • @rawat_ji5183
    @rawat_ji5183 Před 2 lety +1

    amazing explanation ma'am .

  • @ButWhyIn2
    @ButWhyIn2 Před 3 měsíci

    Great Explanation!!!

  • @jatinbhatoya8420
    @jatinbhatoya8420 Před 2 lety +2

    nice one

  • @lavinadhingana555
    @lavinadhingana555 Před rokem +1

    very nice explanation

  • @jayeshkaushik2975
    @jayeshkaushik2975 Před 3 lety +3

    really well explained!!

  • @shreyasharma7987
    @shreyasharma7987 Před měsícem

    Best explanation!!

  • @ece31mohit20
    @ece31mohit20 Před rokem +1

    absolutely gold explanation.

  • @nitantjoshi9903
    @nitantjoshi9903 Před 2 lety +2

    Great explanation.

  • @suvamroy6205
    @suvamroy6205 Před 3 lety +1

    Excellent !!

  • @shubhaamtiwary
    @shubhaamtiwary Před 3 lety +2

    thanks

  • @adityaapoorva2370
    @adityaapoorva2370 Před 2 lety +1

    Thank you so much.

  • @fourieruddin871
    @fourieruddin871 Před rokem

    Thanks !

  • @aakankshasahu4312
    @aakankshasahu4312 Před 2 lety +1

    Wonderful explanation! Thanks

    • @andiamakaza24
      @andiamakaza24 Před 2 lety

      yeh sab interview ke time kese aaiga dimag me?

  • @snehakapoor4314
    @snehakapoor4314 Před 2 lety +1

    well explained!!

  • @letsplay9667
    @letsplay9667 Před 3 lety +1

    Nice video Ma'am

  • @akatsuki1363
    @akatsuki1363 Před 2 lety +2

    Best👌👌

    • @Pepcoding
      @Pepcoding  Před 2 lety

      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/

  • @rishabhmaurya6103
    @rishabhmaurya6103 Před 3 lety +6

    nice explanation mam

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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 )

  • @kunalrastogi6530
    @kunalrastogi6530 Před rokem

    Amazing

  • @sahilsrivastav1203
    @sahilsrivastav1203 Před 3 lety +2

    Mind blowing explanation..

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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 )

  • @nishantpruthi1172
    @nishantpruthi1172 Před 2 lety +2

    Thanks Mam, full concept is clear🤗🤗🤗🤗

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Most welcome 😊
      Keep learning.
      And for better experience and well organised content visit nados.pepcoding.com

  • @dsa3334
    @dsa3334 Před 3 lety +2

    Thank you so much, mam.

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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

  • @rishabhyadav4994
    @rishabhyadav4994 Před 3 lety +2

    superb explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      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

  • @sadmanabedin1203
    @sadmanabedin1203 Před 2 lety +2

    Exact same as leetcode 396

  • @shehreensaifi846
    @shehreensaifi846 Před 3 lety +2

    excellent...plzzz mam continue making videos..it was really helpful

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Sure. Keep learning, Keep growing and keep loving Pepcoding!😊

    • @andiamakaza24
      @andiamakaza24 Před 2 lety

      yeh sab interview ke time kese aaiga dimag me?

  • @LegitGamer2345
    @LegitGamer2345 Před 3 lety +2

    nice explanation

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thanks for liking Keep watching

  • @hmmgmm2841
    @hmmgmm2841 Před rokem +1

    like it giurll😂😂

  • @AKPatil
    @AKPatil Před 2 lety +1

    Mam plz make video on : k maximum sum combination from two arrays

  • @lettry5297
    @lettry5297 Před 3 lety +1

    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.....

    • @Sonsourav
      @Sonsourav Před 3 lety

      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?

    • @lettry5297
      @lettry5297 Před 3 lety

      @@Sonsourav Final year that's why I am asking. I have less time to prepare for other language.

    • @Sonsourav
      @Sonsourav Před 3 lety

      @@lettry5297 final year ending or starting?

    • @lettry5297
      @lettry5297 Před 3 lety

      @@Sonsourav final year ending

    • @LegitGamer2345
      @LegitGamer2345 Před 3 lety

      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

  • @andiamakaza24
    @andiamakaza24 Před 2 lety +2

    yeh sab interview ke time kese aaiga dimag me?

  • @sashwatmishra7853
    @sashwatmishra7853 Před 3 lety

    Can't we do s1=(s0+ sum of array)%n?

    • @mickyman753
      @mickyman753 Před 2 lety

      (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

  • @subhamjyoti1129
    @subhamjyoti1129 Před 2 lety +1

    (●'◡'●) Thnakyou mam so much mam