Skip to content

Instantly share code, notes, and snippets.

View omprakashparida's full-sized avatar

Om Prakash Parida omprakashparida

View GitHub Profile
def power4_sum(arr, index):
# Base case
if index == len(arr):
return 0
current = arr[index]
# Only include negative numbers
if current < 0:
return (current ** 4) + power4_sum(arr, index + 1)