print(is_palindrome("madam")) # Output: True
for num in arr: current_sum = max(num, current_sum + num) max_sum = max(max_sum, current_sum)
for num in arr: complement = target_sum - num if complement in seen: count += 1 seen.add(num)
Example: Input - [-2, 1, -3, 4, -1, 2, 1, -5, 4], Output - 6
Given a linked list, find the middle element.