Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A competition to solve a particular problem through the usage and manipulation of strings.
2
votes
String Concatenation
Haskell, 56 55 bytes
import Data.List
x%y|(0<$y)<(0<$x)=y%x|z<-y\\x=x++'_':z
-1 byte thanks to @xnor
4
votes
Magic mirror madness
Haskell (no regex), 117 bytes
r=reverse
s=span(<'|')
m=zipWith min
g a|(b,l:c)<-s a,(d,e)<-s c=b++l:g(m(r b++[l,l..])d++e)|0<1=a
f x=m(g x)$r.g.r$x
20
votes
Make a "Ceeeeeeee" program
Explanation
(%) is called as w%c, with w being the input string, and c the character to keep. … |(d,_:y)<-span(==c)x -- split x; bind the string of `c` to d, and the rest
-- to _:y, dropping first character and calling the rest y. …
2
votes
Lemon-Limify a String
Haskell, 109 bytes
f s|n<-length s,r<-[1..n]++[n-1,n-2..1]=unlines[do x<-r;min(" ~"!!mod((x+y+n)*min(n-x-y)0)2)<$>take x s|y<-r]
11
votes
Square, diamond, square, diamond
Haskell, 138 137 136 bytes
q 1=0
q x=(mod x 2+1)*(q(x-1)+1)
f x|m<-q$length x,n<-abs<$>[-m..m]=[do j<-n;max" "[c|(k,c)<-zip[1..]x,cycle[max i j,i+j]!!k==q k]|i<-n]
Defines a function f which return …
6
votes
Draw my downslashes
Haskell, 49 bytes
scanl(\x c->drop(sum[1|'/'<-c:x])(' '<$x)++[c])[]
Try it online!
4
votes
Fill in the Minesweeper clues
Haskell, 115 bytes
z=zip[1..]
x%i=[a|(j,a)<-z x,abs(i-j)<2]
f x=[[head$[c|c>' ']++show(sum[1|'*'<-(%j)=<<x%i])|(j,c)<-z r]|(i,r)<-z x]
Defines a function f on lists of strings
30
votes
Print a Tabula Recta!
Python 2, 59 57 53 bytes
a=range(65,91)*27
a[::-27]=[10]*26
print bytearray(a)
Thanks to @xsot for -4 bytes!