find max sequence code