This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reverseString = str => [...str].reverse().join(''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const palindrome = str => { | |
const s = str.toLowerCase().replace(/[\W_]/g, ''); | |
return s === s.split('').reverse().join(''); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstddef> | |
template<typename T> | |
struct IsArray | |
{ | |
static constexpr bool value = false; | |
}; | |
template<typename T> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
template<int n> | |
struct facto | |
{ | |
static constexpr unsigned int value = n * facto<n - 1>::value; | |
}; | |
template<> | |
struct facto<0> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
primes = filterPrime [2..] | |
where filterPrime (p:xs) = | |
p : filterPrime [x | x <- xs, x `mod` p /= 0] |
NewerOlder