Run time error

Hi! Here’s the link to my solution to this question. I don’t know why is it showing Run time error SIGSEGV, I’ve checked many times.

Brother, the hyperlink for ‘this’ is wrong though it’s understandable that it’s actually SEATSR from the tag. Your solution shows confusing use of some ‘for’ loops as their accompanying braces are absent. For example, the lengths of the strings can be 100000 each. So total memory you’ll need to allocate is 10000000000 bytes. It goes over 1500 MB . Hence, SIGSEGV(Segmentation fault:Core dumped). I’m pretty sure that you yourself can rectify the problem, if needed, you can always refer to one’s solution in a particular language because our intention is to learn.


You have declared two arrays char str[100005],wtr[100005]; and also int d[m+1][n+1]; where m and n are length of the strings str and wtr. So, declaring a double dimensional array of length 100000*100000 requires a lot of memory because of constraints which are: 1 ≤ |s|, |w| ≤ 100000. Hence you need to change your implementation. Please see the editorial :slight_smile: Editorial . Normal Levenshtein would not work because of time and memory constraints.


I have tried making in small changes in the Wagner Fischer in other solutions of mine but that also consists of this array d. Thanks for the help! :slight_smile:

Corrected. Thanks! :slight_smile: