is an out-of-bounds access and hence Undefined Behaviour:
[simon@simon-laptop][21:49:14]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh
Compiling akshay_012-SSCRIPT.cpp
+ g++ -std=c++14 akshay_012-SSCRIPT.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv
akshay_012-SSCRIPT.cpp: In function ‘void KMPSearch(char*, char*)’:
akshay_012-SSCRIPT.cpp:16:16: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
int M = strlen(pat);
~~~~~~^~~~~
akshay_012-SSCRIPT.cpp:17:16: warning: conversion to ‘int’ from ‘size_t {aka long unsigned int}’ may alter its value [-Wconversion]
int N = strlen(txt);
~~~~~~^~~~~
+ set +x
Successful
[simon@simon-laptop][21:49:20]
[~/devel/hackerrank/otherpeoples]>echo "3
5 2
*a*b*
5 2
*a**b
5 1
abcde" | ./a.out
akshay_012-SSCRIPT.cpp:110:11: runtime error: index 2 out of bounds for type 'char [*]'
NO
YES
NO
What’s wrong in my solution in question worthy matrix?
Solution link:- CodeChef: Practical coding for everyone
I have used prefix sum matrix
Then do binary search where square matrix solutions exist…
@prash_pra2 Who knows, maybe they will, maybe you will get link for interview and thats it for you. You wont pass the interview cause you don’t really know anything except for searching solutions on youtube.
You can’t just call someone cheater coz you feel like so
Why edit your reply. I don’t think you know that others can look onto your submissions and i don’t think you know anything about MOSS either. You just log onto codechef, copy paste answer and call it a day.