How to resolve the algorithm Palindrome detection step by step in the Yorick programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Palindrome detection step by step in the Yorick programming language

Table of Contents

Problem Statement

A palindrome is a phrase which reads the same backward and forward. Write a function or program that checks whether a given sequence of characters (or, if you prefer, bytes) is a palindrome. For extra credit:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Palindrome detection step by step in the Yorick programming language

Source code in the yorick programming language

func is_palindrome(str) {
    s = strchar(str)(:-1);
    return allof(s == s(::-1));
}

func prep_palindrome(str) {
    s = strchar(strlower(str));
    w = where(s >= 'a' & s <= 'z');
    return strchar(s(w));
}

  

You may also check:How to resolve the algorithm Percolation/Mean run density step by step in the Haskell programming language
You may also check:How to resolve the algorithm Calendar - for REAL programmers step by step in the Seed7 programming language
You may also check:How to resolve the algorithm N-queens problem step by step in the Pascal programming language
You may also check:How to resolve the algorithm Lychrel numbers step by step in the J programming language
You may also check:How to resolve the algorithm Runtime evaluation step by step in the Maxima programming language