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 18535

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

2
votes
Ruby, 36 31 24 23 bytes ->l{l-l.map{|x|7-x}==l} Try it online! It was so simple, I was looking for the solution to the wrong problem all the time.
answered Dec 4 '17 by G B
1
vote
Ruby, 21 bytes ->x{x*?!!~/[^2!]|22/} Using a regex is actually shorter, because joining an array also flattens it. How it works ->x{ x*?! -> Join array using an exclamation m …
answered May 16 '17 by G B
2
votes
Ruby, 54 bytes ->a,b,m{m.reduce{|x,y|x[0..-2]==y[1,b]?y:[]}.size<=>1} Exactly as specified, can be golfed more if flexible input/output is accepted. Explanation: Iterate on the matrix, and comp …
answered May 18 '17 by G B
2
votes
Ruby, 104 99 91 bytes ->x{[7,56,448,292,146,73,84,273].none?{|y|b=x.to_i 2;((a=x.count'1')==4?b:a==5?~b:7)&y==y}} Input format: binary string of 9 symbols (0s and 1s) representing the board, for ex …
answered Dec 12 '16 by G B
1
vote
Ruby, 44 bytes ->a{a.all?{|x|x<0||(w=a[x])&&x!=w&&a[w]==x}} Try it online!
answered Sep 5 '18 by G B
5
votes
Ruby, 46 40 38 bytes f=->r{a,*b=r;!a||b==b&[*0..a]|b&&f[b]} Try it online! This works by recursively taking the first element a as a pivot, and checking if the rest of the array can be split in …
answered Oct 19 '18 by G B
1
vote
Ruby, 64 bytes ->a{!([a[/(\d)\1*$/].size,$`.chars.max]*?x!~/x1$|^2x[49]|^3x8/)} Input as a string, returns true if: B==1 (no need to check A) A==4 and B==2 A==9 and B==2 A==8 and B==3 Try it …
answered Dec 18 '17 by G B
14
votes
Ruby, 22 19 bytes ->x,y{390[(x-y)%9]} Input: ASCII code of the 2 characters. Output: 1 for allies, 0 for enemies. How it works: Get the difference between the 2 numbers modulo 9, use a bitmask (3 …
answered Mar 13 '17 by G B
2
votes
Ruby, 50 bytes ->x{a=b=0;b&&=x[a/2]==x[a]+x[a-1]while x[-a-=2];b} Reversing the array, any element of the first half (position n) must be the sum of the elements in position n*2 and n*2+1.
answered Mar 15 '17 by G B
0
votes
Ruby, 16 bytes ->n{n**0.5%1==0} Trivial solution.
answered Jan 12 '18 by G B
1
vote
Ruby, 69 bytes ->a,b{(0..a+b=~/$/).all?{|r|(0..r).sum{|w|a[w].to_i*b[r-w].to_i}<10}} Try it online!
answered Dec 19 '17 by G B
2
votes
Ruby, 55 bytes ->n{a=*b=1;a<<b*=2until b>n;n.to_s=~/^(0*(#{a*?|}))*$/} Try it online! Output is 0 if true and nil if false.
answered Oct 12 '18 by G B
1
vote
Ruby, 23 bytes ->a{a[2..-1]==a[0..-3]}
answered Dec 22 '16 by G B
1
vote
Ruby, 73 bytes ->n{(1...n).any?{|b|(1...b).any?{|c|[n+b,b+c,n+c].all?{|r|r**0.5%1==0}}}} Try it online!
answered Jan 12 '18 by G B
1
vote
Ruby, 25 bytes ->w{w+?t!~/[^aeiouy]{2}/} Try it online! Everybody else is doing it, so why can't Ruby?
answered Aug 10 '18 by G B

15 30 50 per page