> I've got a sorted list of numbers, and I want to find the longest run > of consecutive integers: > > 2 4 5 6 12 --> 3 > 1 2 3 4 5 6 --> 6
My simple solution: ms =: [: >./ [: (# ;. 2) 0 ,~ _1 = 2-/\] Seems to be pretty fast one: in =: 1e6 [EMAIL PROTECTED] 10 6!:2 'ms in' 0.0336962 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
