Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
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
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
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
Results tagged with Search options user 60340

For challenges which involve deciding whether or not the input meets certain criteria, and outputting some data, representing that decision.

8
votes
Haskell, 33 28 bytes f a=cycle"yn"!!sum[1|'n'<-a] Indexes the count of n's into the infinite list "ynynynyn…". Previous approach (33 bytes) was folding pairs of different elements to n, otherwis …
answered May 22 '18 by Angs
4
votes
Haskell, 54 52 bytes Thanks @Laikoni for saving two bytes. (%)=all.flip elem k n|[a,b]<-show<$>[n,n^3]=b%a&&a%b
answered Nov 14 '16 by Angs
1
vote
Haskell, 114 95 88 84 bytes (o%h)g|elem(o,g)h=1<0|(a,(l,r):b)<-splitAt o g=null b||(l%((o,g):h)$a++(r,l):b) 0%[] Keeps a history of visited (location, network) pairs to be able to decide a failure. …
answered Dec 1 '16 by Angs
6
votes
Haskell, 90 84 bytes a%[]=[a] (t:z)%x@(s:y)=[a|a<-z%y,t==s]++[t:s|s<-z%x] _%_=[] ((all=<<(==).head).).(%) Construct the list of all possible subtracted sequences nondeterministically and checks whe …
answered Dec 5 '16 by Angs
2
votes
Haskell, 106 102 98 110 109 102 bytes (\a->all(==[])a||and(e((1<$)<$>a):map(all(>='!').($a))[head,last,map$last,map$head]));e(a:s)=all(==a)s Thanks to @nimi and @Laikoni for a byte each! Try it …
answered May 2 '18 by Angs
2
votes
Haskell, 68 66 bytes d 0=[] d n=mod n 10:d(div n 10) sum.(\a->map(^length a)a).d>>=(==) Usage: *Main> sum.(\a->map(^length a)a).d>>=(==) $ 1634 True
answered Nov 8 '16 by Angs
0
votes
Haskell, 182 163 162 132 bytes (#)=zipWith(-) a&b|s<-abs<$>a#b=or[all(==1)$tail a#a|(x,h:y)<-p s,(q,r)<-p$x++y,a<-[q++h:r],a/=s] p l=[splitAt k l|k<-[0..length l]] Takes input as a list of digits …
answered Jun 9 '18 by Angs
9
votes
Haskell, 73 72 71 69 67 66 bytes any(\a->sum[1|x<-a,x>29,take 4a<a]>2).scanl(\a t->[0|t>24]>>t:a)[] Thanks to @flawr and @Laikoni for two bytes each and @xnor for a byte! Try it online! Equal l …
answered Apr 23 '18 by Angs
0
votes
Haskell, 61 bytes g[a,b]=0>1 g(a:b:c)=a==last c&&b==succ a&&g(b:init c) g _=1>0
answered Nov 18 '16 by Angs
6
votes
Haskell, 89 88 86 bytes f n|n<2=[n]|1>0=mod n 2:f(div n 2) g n=elem(product$zipWith(+)(f n)$reverse$f n)[1,2] Works by summing bitwise the bit representation with its reverse and taking the product …
answered Oct 6 '16 by Angs