why is my code giving segmentation fault.
check it and correct it and also optimize it if possible
Runtime error in code
@D19APPPP0016
Segmentation fault is a specific kind of error caused by accessing memory that “does not belong to you.”
You can refer this for more detail:
here is the correct optimised approach to this
This is not my answer. I asked you to find the error in my code and help me rectify it.
And Please don’t reply again after one day .Reply ASAP.
@D19APPPP0016
you asked about segmentation error i have provided you with the explanation.rectify that in your code .
you should tag me so that i get a notification of your reply.
also i have provided you with the most optimized approach. modify your logic after learning from it.
always take a look at constraints too whether int satisfies or not
I have already done it using DSU Algo but i am not able to find the error in my code.Please make the modifications in my code.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.