Here is my code .
Giving Runtime Error , but i couldn't get why?
refer to this code
No , sir I wanted to ask why my code is giving Runtime error , i couldn’t figure out that , i know the logic and other way also to do that but why is my code giving runtime error .
for small test cases the correct does not give Runtime error
this is error is usually because of memory access outside the scope of the program
and like the test case are really large
also ur code approach fails the basic test case bhaiya discussed in the hint video
i/p
14 3
1 2 4 2 3 4 5 1 2 0 1 5 9 2
req o/p
26
ur o/p
17
No , Ma’am my code is giving 26 as the output and not 17 !!
see for small test cases as i have check the code is running fine
but then the test case files are so big that i am even unable to load them let alone run them by giving them as input
and i see no place where some index out of bound is being accessed.
So either u can reopen ur doubt ur go by my approach its exactly what prateek bhaiya discussed in the video
his words have been pen down in the code
Okay ma’am …