I am not able to understand why I am getting segmentation fault in the below code
There were some minor errors. I have changed the data type to long long int for array r and c. Also size of r and c is upto 1e5 and declaring them upto 1e10 will result in segmentation fault. Also while comparing diameter[i] with start, check for equality also.
Code for reference : https://ide.codingblocks.com/s/201927
hope it helps.
Still I am getting error in the code.
And thank you for your prompt response
The link i have provided is working on all the test cases. You might be making minor errors. Try to debug it.
Hope it Helps.
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.