Skip to content

Instantly share code, notes, and snippets.

const reverseString = str => [...str].reverse().join('');
const palindrome = str => {
const s = str.toLowerCase().replace(/[\W_]/g, '');
return s === s.split('').reverse().join('');
};
#include <iostream>
#include <cstddef>
template<typename T>
struct IsArray
{
static constexpr bool value = false;
};
template<typename T>
#include <iostream>
template<int n>
struct facto
{
static constexpr unsigned int value = n * facto<n - 1>::value;
};
template<>
struct facto<0>
@ahafidi
ahafidi / primes.hs
Last active November 2, 2020 08:27
Haskell — Prime numbers
primes = filterPrime [2..]
where filterPrime (p:xs) =
p : filterPrime [x | x <- xs, x `mod` p /= 0]