DataWeave interview question

write a palindrome, anagram program , explain the time and space complexity