Segmentation Fault when running code for problem

Hello,
I have followed the code as shown in the video solution for this problem. However, when running with test Input I receive ‘Segmentation Fault’. Could you help with what might be causing this issue?

Additionally, is there a location to access the code shown in the video (C++) ? The Editorial section lists an edited version of what was shown in the video.

Solution IDE Link: https://ide.codingblocks.com/s/383356

here:


you forgot to return from your base case
if this solves your doubt please mark it as resolved

Thank you @Abha. This solved the issue. Additionally, is there a location to access the code shown in the video (C++) ? The Editorial section lists an edited version of what was shown in the video.

there are no saved code for these videos, you should write the code yourself after watching videos