Python Solution, super easy to understand


  • -1
    W

    def rb(x):
    final = []
    for i in range(len(x)-2):
    j = i
    mo = []
    while((j+2)<=len(x)+1):
    mo.append(x[j])
    j = j+2
    final.append(sum(mo))
    print("plan",mo)
    print("final Plan",final)
    return(max(final))


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.