79282434

Date: 2024-12-15 13:43:49
Score: 0.5
Natty:
Report link

This solution done by the list

  1. get all the element in the list
  2. get the variable 0 and the length of the list
  3. sum both the variable
  4. increase the first one and decrease the last
def pairSum(head):
    vec_list = []
    while head:
        vec_list.append(head.value)
        head = head.next
    
    max_sum = 0
    len_vec_list = len(vec_list) -1
    i = 0 
    j = len_vec_list
    while i<j:
      
        cur_sum = vec_list[i] + vec_list[j]
        max_sum = max(max_sum,cur_sum )
        i = i+1
        j = j-1
    return max_sum
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: amardip kumar