Please Help me with this

this is my code

hello @dhruvilcodes what is your doubt in the above question ?

it is giving sample question correct but further cases it gives segmentation fault

@dhruvilcodes this generally comes when you logic is not correct or optimised .
this means that you to think more optimised approach for it .

but i dont know about optimisation can you help me with my code?>

yes sure .
please give me some time .

1 Like

hello sir are you there?

hey @dhruvilcodes i have corrected the code and it is passing every test case .
please go through the code which i am giving you in the link below .


if you have any doubt please ask here .
if you feel that your doubt is cleared please mark this doubt as resolved and do give the star ratings .
Happy Learning !!

sorry @dhruvilcodes there was some network issue thats why it tool time for me.
Happy Leaning !!

1 Like

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.