What is wrong with my solution?

I have doubt in this solution. Please help. Like why my answer is wrong.
Question - CodeChef: Practical coding for everyone
My solution - CodeChef: Practical coding for everyone

Your variable introdur may lead to overflow as after adding up the duration of all intros, the total value might exceed the limit of int data type.
Therefore intialize it as,
long int introdur=0;

1 Like

Thanks for the help buddy. Don’t know how I neglected this. I have already made ‘duration’ from int to long but forgot about ‘introdur’ in one of my previous solution - CodeChef: Practical coding for everyone

Now it’s Working fine - CodeChef: Practical coding for everyone