added isAnagram and findMToLastElement