code is same as video https://ide.codingblocks.com/s/263205
Segmentation fault
add line 53
this prevents -ve indexed from being access
the run time error was because -1 index was being accessed
refer to this
@chhavibansal i cannot figure out the difference between the 2 codes. The one you provided is running without that condition, and it got AC too. Please help me figure out what is wrong with this code
wait let mee check…
just a minor update
i - m>= 0
see
in my code there are situations where -1 index is being accessed , it is a bad practice to access -ve indexes but here in the code ( my code) the -ve index is accessed without giving runtime error
but the memory allocation for ur code might be such that the access is not possible hence the additional check is required that -ve index are not accessed