update longestPairLength