solutions to Regex Golf
- Warmup:
foo
- Anchors:
ick$
- Ranges:
^[a-f]+$
- Backrefs:
(...).*\1
- Four:
(.)(.\1){3}
(def fib-lazy-cat | |
(lazy-cat [0 1] (map +' fib-lazy-cat (rest fib-lazy-cat)))) |
(defn infix | |
([x op y] (op x y)) | |
([x op y & more] | |
(apply infix (cons (infix x op y) more)))) |
import java.io.PrintWriter; | |
import java.util.Scanner; | |
public class Main { | |
static Scanner cin = new Scanner(System.in); | |
static PrintWriter cout = new PrintWriter(System.out, true); | |
int MAXV = 10012; |
(def prime-seq | |
((fn prime [seq] | |
(lazy-cat [(first seq)] (prime (filter #(not= 0 (rem % (first seq))) (rest seq))))) | |
(iterate inc 2))) | |
(take 10 prime-seq) | |
;; (2 3 5 7 11 13 17 19 23 29) |
import qualified Data.ByteString.Lazy as L | |
str2action :: String -> IO () | |
str2action input = putStrLn ("Data: " ++ input) | |
list2actiosn :: [String] -> [IO ()] | |
list2actiosn = map str2action | |
numbers :: [Int] | |
numbers = [1..10] |
class Solution: | |
# @param {string} a | |
# @param {string} b | |
# @return {string} | |
def addBinary(self, a, b): | |
return bin(long(a, 2) + long(b, 2))[2:] |
; 1, Nothing but the Truth | |
true | |
; 2, Simple Math | |
4 | |
; 3, Intro to Strings | |
"HELLO WORLD" | |
; 4, Intro to Lists |
foo
ick$
^[a-f]+$
(...).*\1
(.)(.\1){3}
#include <iostream> | |
#include <cstdio> | |
#include <cstring> | |
#include <numeric> | |
#include <algorithm> | |
using namespace std; | |
typedef long long i64; |
#include <iostream> | |
#include <cstdio> | |
#include <cstring> | |
#include <numeric> | |
#include <algorithm> | |
using namespace std; | |
typedef long long i64; |