merge sorted array and valid palindrome: two pointers and end merge