Haskell Century From Year
centuryFromYear :: Int -> Int
centuryFromYear year = ceiling (fromIntegral year / 100 :: Double)

This converts a year into its century. Years 1-100 are century 1, 101-200 are century 2, and so on.

Java Century From Year
public class Solution {
    public static int centuryFromYear(int year) {
        return (int) Math.ceil(year / 100.0);
    }
}

This converts a year into its century. Years 1-100 are century 1, 101-200 are century 2, and so on.

Lisp Century From Year
(defun century-from-year (year)
  (ceiling year 100))

This converts a year into its century. Years 1-100 are century 1, 101-200 are century 2, and so on.

PHP Century From Year
function centuryFromYear($year) {
    return ceil($year / 100);
}

This converts a year into its century. Years 1-100 are century 1, 101-200 are century 2, and so on.

Python Century From Year
import math


def century_from_year(year: int) -> int:
    return math.ceil(year / 100)

This converts a year into its century. Years 1-100 are century 1, 101-200 are century 2, and so on.

Rust Century From Year
fn century_from_year(year: i64) -> i64 {
    (year as f64 / 100.0).ceil() as i64
}

This converts a year into its century. Years 1-100 are century 1, 101-200 are century 2, and so on.

TypeScript Century From Year
function centuryFromYear(year: number): number {
  return Math.ceil(year / 100);
}

This converts a year into its century. Years 1-100 are century 1, 101-200 are century 2, and so on.

Bash Check Palindrome
check_palindrome() {
    local _s=$1
    local _rev=""
    local _i
    for ((_i = ${#_s} - 1; _i >= 0; _i--)); do
        _rev="${_rev}${_s:_i:1}"
    done
    if [[ "$_rev" == "$_s" ]]; then echo true; else echo false; fi
}

This compares the string with its reverse. If they match, it is a palindrome.

C++ Check Palindrome
#include <string>

bool checkPalindrome(const std::string& inputString)
{
    return std::string(inputString.rbegin(), inputString.rend()) == inputString;
}

This compares the string with its reverse. If they match, it is a palindrome.

C# Check Palindrome
static bool CheckPalindrome(string inputString)
{
    var reversed = new string(inputString.Reverse().ToArray());

    return reversed == inputString;
}

This compares the string with its reverse. If they match, it is a palindrome.