ProstDev ProstDev

DataWeave programming challenge #3: Count palindrome phrases using the Strings module

Thumbnail: DataWeave programming challenge #3: Count palindrome phrases using the Strings module
Watch on YouTube

About this video

Identify which phrases are palindromes (ignoring case, spaces, and punctuation), then sum the character counts of those phrases using the DataWeave Strings module. Clues and full solutions are in the companion article.

Resources

Transcript

Intro

Hi, I’m Alex Martinez, I am ProstDev’s founder, and today I bring to you challenge number three of DataWeave.

The challenge

In this challenge we have a list of different phrases, and we will have to figure out whether these phrases are palindromes or not. If you’re not familiar with what a palindrome is, it’s basically a phrase, a word, a date — something that can be read in the same way from left to right and from right to left.

Note that this does not include punctuation, special characters, or spaces. For example, this phrase, “Mr. Owl ate my metal worm” — we can still read the phrase if we read it backwards. The same applies for here, this is a question mark that should not be taken into account, but this phrase is also a palindrome. The same applies for one word like “Anna” — even if the first A is uppercase, it should not matter. And the same should apply for dates as well: 2020-02-02, if you read it backwards it still says 2020-02-02.

After you can correctly identify which of all of these phrases are palindromes, you will now have to count all the characters in each of the phrases — this time including punctuation signs, spaces, or any other kind of character. After you get the character count of each one of these phrases, then you will sum them all to retrieve one single number. In this case the total sum of all of the palindrome phrases is 148.

Clues and solutions

That’s it for this challenge, I hope you like it. Remember to go to ProstDev.com/blog to read all of the other challenges. If you’re watching this from YouTube, go into the description of the video and you’ll be able to find the article link to find all of the clues and the correct answer — or one of the correct answers, there are a ton of them that you can create. You can also comment your own solutions so others can learn from you. Remember to subscribe so you get notifications as soon as new challenges are uploaded. Good luck!

More from DataWeave Challenges

Search

Loading search…