Sort by

recency

|

25 Discussions

|

  • + 0 comments

    Python

    n = int(input())
    
    arr = list(map(int, input().split()))
    
    og_sum = sum(arr)
    
    total_sum = sum([(i+1) * arr[i] for i in range(n)])
    max_sum = total_sum
    
    
    for i in range(1, n):
        total_sum += (n * arr[i-1]) - og_sum
        max_sum = max(max_sum, total_sum)
        
        
    print(max_sum)
    
  • + 0 comments

    Python. Small Code.....

    n=int(input())
    x=[int(i) for i in input().split()]
    s=sum(x)
    p=0
    for i in range(n):p+= (i+1)*x[i]
    ma=p
    for i in range(n-1,-1,-1):
        p+=s-n*x[i]
        ma=max(p,ma)
    print(ma)
    
  • + 0 comments

    We can expect lots of explanation with examples from various cbd gummies for anxiety topics of maths from here. I think this site offers lots of solved examples from each of the topic. I am looking for further updates from here. Keep up the good work.

  • + 1 comment

    from collections import *

    n=int(input()) l=list(map(int,input().split())) ans=[] for i in range(0,n+1):

    d=deque(l)
    
    d.rotate(i)
    pr=1
    for j in range(0,len(d)):
        pr=pr+(j+1)*d[j]
    ans.append(pr)
    

    print(max(ans)-1)

    Why does this Solution gives a TLE ?? It can be the easiest amongst all?

  • + 0 comments

    My normal solution with comments line

    https://github.com/joy-mollick/Problem-Solving-Solutions-Math-Greedy-/blob/master/HackerRank-Game%20Of%20Rotation.cpp