Vague observation MCHEF JULY LONG CHALLENGE

data-structure
dynamic-programming
easy-medium
ma5termind

#1

In my solution http://www.codechef.com/viewsolution/7479607 , in the nested for loop in main, if I don’t use the variable val and directly write j<=L*.size()-1, then it is not running. Why is that so?


#2

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*.size()-1), it should work.


#3

thanks so much!