Relative Content

Tag Archive for pythonrecursionruntime-error

Runtime Error Hangup(SIGHUP) for recursion solution to sum of series problem

Problem: Given an int N, calculate the sum of series 13+23+33+43…… till the nth term using recursion (Link to problem) Implemented Solution in Python: #User function Template for python3 class Solution: def sumOfSeries(self,n): #code here if n>0: return (n*n*n) + self.sumOfSeries(n-1) else: return 0 #{ # Driver Code Starts #Initial Template for Python 3 if […]