Getting RE (SIGSEGV) in Tree House

This is my code for the problem THOUSES. The logic is the same as the setter’s solution, but getting RE(SIGSEGV) on tc 3.

https://www.codechef.com/viewsolution/50441364

2 Likes

Thank you.
Setter’s solution is also not working without increasing the stack limit.