similar to longest sequence