Thomas Eding
• Member for 10 years, 8 months
• Last seen more than a month ago
• United States

Haskell, 75 bytes - 1002 output A sieve approach that returns a minimal solution. (\n->head.filter(\s->and[show kisInfixOfs|k<-[1..n]]).map show$[1..])1000 Note that this solution is ... View answer 3 votes Haskell, 82 bytes c=cycle[(<),(>)] l!n=n>9&&and(zipWith3($)l(show n)$tail$show n) u n=c!n||((>):c)!n Try it online!

C/C++/Objective-C 126 characters (includes required trailing newline) #define b(t)(t->left||t->right) void f(Node*r){while(r&&b(r)){Node**p=&r,*c=b(r);while(c)p=&c,c=b(c);free(*p)...

Haskell - 14 characters main=putStr"." The penguin this program displays is in the far distance.

Haskell 65 characters import List main=n<-readLn;print$findIndices(>n)[2^n|n<-[0..]]!!0 View answer 1 votes Haskell, 150 characters main=putStr.g.f.map read.words=<<getLine f[a,b]|belemdropWhile(/=a)[(minBound::Int)..]="BA"|0<1="AB" g[x,y]="Integer "++x:" is ... View answer 0 votes Poop - 72 characters f[s]s^6pow>4<<last&8*(/"ed""id""eid"/|out|flush)+rep'y'1-2-3"aeiou"ord#s View answer 1 votes Haskell - 8 characters (Infinite difference) f=f.(+1) Use f on Integer. View answer Accepted answer 11 votes Haskell - 80 characters l=length main=interact$ \s->show$map($s)[l,l,l.lines,maximum.map l.lines,l.words]

Haskell 331 357 339 characters Golfed: import Data.Char t[x,y]=q[x,mod(y+1)8] q z@[x,y]|x==y=[x+1,y+2]|0<1=z x%y=[x,y] c 65=0%1 c 74=6%4 c 75=1%4 c 79=2%3 c 84=3%4 c 86=4%7 c 87=5%6 c 89=3%6 c 90=6%...

Haskell Easy 4 characters Returns a list of jolly integers if and only if a list of jolly integers is given as input. This is legal based on "Just a function that accepts arguments however and ...

Haskell 89 74 charaters main=do n<-readLn;mapM_(putStrLn.take n).take n.cycle$map cycle["X "," X"] View answer 0 votes Haskell Naive algorithm: import Data.Set (Set) import qualified Data.Set as Set type Id = Integer data Node a = Node { getValue :: a, getId :: Id } hasLoop :: [Node a] -> Bool hasLoop = hasLoop' ... View answer 7 votes Sometimes declaring a variable (or more) as function parameters can save some strokes by avoiding the var keyword. This use case is fairly rare though: function f(){var i} => function f(i){} Also ... View answer 1 votes Primary answer: Does not use crazy macro expansion. Uses recursion and two 8 bit variables. The code works by recursing enough such that the first call to foo generates enough calls where the ... View answer 2 votes Haskell, 63 56 characters Handles ℤ>0 (56 characters) main=do n<-readLn;print$last[p|p<-[0..n],b<-[0..n],b^p==n] Handles ℤ≥0 (58 characters) main=do n<-readLn;print$last[p|p<-[0..n+... View answer 6 votes Haskell, 276 261 259 257 243 characters Here is my inefficient solution. It works on unbounded (and bounded) integers. This solution happens to work correctly with non-exact division (eg: 5 / 2 = 2). ... View answer 1 votes Haskell, 115 characters import List main=readLn>>=print. \r->head$findIndices(all(elem"12").take r.(++cycle"0").reverse.show)$iterate(*2)1 View answer 0 votes Haskell, 136 characters main=interact$show.n.q.map read.words n x=snd$minimum$map(\p@(a,b)->(sum$map(\(x,y)->max(abs$a-x)$abs$b-y)x,p))x q[]=[] q(x:y:z)=(x,y):q z

Haskell, 74 Felt like doing the brute force way. import List main=print.f=<<readLn f n=elem n$map sum$tails=<<inits[1..n-1]

Haskell, 96 characters main=getLine>>=print.d.map read.words d[x,y]=pred.snd.head.filter((>x).fst)$map(\n->(n*y,n))[0..] Input is on a single line. The code just searches for the answer ... View answer 1 votes Haskell, 2^6 characters import List f=fmap(map(\x->(x!!0,length x)).group.sort).readFile View answer 5 votes Haskell, 38 Constraints 1 and 3 followed. main=putStr$map succ"G\x64kkn\USVnqkc"

Javascript, 202 characters function r(s){var s=s.split(""),h=[-1],n=s.length-1,t,i;h[-1]=s[0];for(i=0;++i<n;){do{t=Math.random()}while(t in h);h[t]=s[i];h[i]=t;}h.sort();for(i=0;i<n;++...

Java, 194 charcters String r(String s){String[]c=s.split("");if(c.length>2)java.util.Collections.shuffle(java.util.Arrays.asList(c).subList(2,c.length-1));return(""+java.util....

Haskell, 195 import Random import Data.List r l=fmap(f l.g l)newStdGen f l n=map snd$head$filter(\l->map fst l==n)$permutations$zip[0..]l g l=take(n+2).(0:).(++[n+1]).take n.nub.randomRs(1,n)where ...
Haskell, 52 main=putStr$map(enumFrom 'G'!!)[1,26,44,36,30,37,37] Could be shorter if the answer can be case insensitive. I chose to start at 'G' because Haskell has no G's in its name, and 'G' comes ... View answer 5 votes Haskell, 47 data H=Haskell deriving Show main=print Haskell View answer -2 votes Haskell, 44 characters n True=1 n _=1-2 g a b c d e f=n$a^b^c>d^e^f Runs under a second for all the test examples on my machine.