longest consecutive seq reimpl