In my solution CodeChef: Practical coding for everyone , in the nested for loop in main, if I don’t use the variable val and directly write j<=L[i].size()-1, then it is not running. Why is that so?
Because size() returns unsigned int. If size() is 0, subtracting 1 from it will give a huge number (2^32 - 1). If you change it to (j <= (long int) L[i].size()-1), it should work.
4 Likes
thanks so much!