Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

New answers tagged

0 votes

Check membership of an infinite list

Desmos, 41 bytes f(k)=∑_{n=0}^{(k-g(0))^2}0^{(g(n)-k)^2} Because Desmos does not support infinite lists and does not support functions as arguments, the input list ...
user avatar
  • 3,958
0 votes

Check membership of an infinite list

Pip -x, 24 bytes W(Y(bi))CMa=yCM(bUi)_a=y Uses the third format of infinite list: "A function... that outputs the nth ...
user avatar
  • 31.8k
1 vote

Find run ascending lists faster

Python, I'm not sure of the exact complexity. Probably exponential in the worst case. ...
user avatar
  • 3,007
1 vote

Can a run ascending list be made?

Charcoal, 59 bytes ⊞υ⟦±¹θ⁰⟧FυF…⊟ι⌈§ι¹FLθF∧⁻λ§ι⁰›§§ι¹λκ⊞υ⟦λE§ι¹⁻ν∧⁼ξλ⊕κ⊕κ⟧⬤υ⌈⊟ι Try it online! Link is to verbose version of code. Outputs nothing if a run ...
user avatar
  • 143k
1 vote

Can a run ascending list be made?

Burlesque, 32 bytes {+.bxj.*}wiFLr@{gw)-]qU_qsom&}ay Try it online! Drastically inefficient brute force ...
user avatar
0 votes

Can a run ascending list be made?

Husk, 12 bytes ¬ΛȯV≤mLgP`ṘN Try it online! Brute force approach, times out for even moderate inputs. TIO link includes a set of very short true & false inputs....
user avatar
2 votes

Can a run ascending list be made?

Brachylog, 15 bytes {igᵗj₍}ᶠcpḅlᵐ<₁ Try it online! Times out on most of the test cases. I believe the algorithm is something like \$O(S!)\$, where \$S\$ is the ...
user avatar
  • 31.8k
2 votes

Can a run ascending list be made?

Vyxal, 17 bytes żZødṖƛĠvL2lvƒ>A;G Try it Online! Port of 05AB1E. vw and f are only ...
user avatar
  • 4,206
2 votes

Can a run ascending list be made?

JavaScript (ES6), 84 bytes Returns \$0\$ or \$1\$. ...
user avatar
  • 166k
5 votes

Can a run ascending list be made?

05AB1E, 13 bytes āsÅΓœεÅγü›P}à Brute-force approach, so extremely slow. Try it online or verify some of the smaller test cases. Explanation: ...
user avatar
7 votes

Can a run ascending list be made?

Python 3, 106 bytes def f(a,n=-1,x=0):a[n]-=x;return~-any(a)^any(f(1*a,i,j+1)for i,k in enumerate(a)for j in range(x,k)if i-n) Try it online! Brute force search. ...
user avatar
  • 6,240
4 votes

Don't break the bridges!

Python3, 560 bytes: ...
user avatar
  • 2,520
0 votes

Is it an Odd Word?

Python 3, 42 bytes lambda x:sum(c in"aeiouAEIOU"for c in x)%2 Try it online!
user avatar
  • 3,053
1 vote

Is it an Odd Word?

Vyxal, 3 bytes A∑∷ Try it Online!
user avatar
  • 4,206
0 votes

Is it an Odd Word?

Factor, 34 bytes [ [ "aeiouAEIOU"in? ] count odd? ] Try it online!
user avatar
  • 8,908
3 votes

Crossing a Lily Pond

Pip -xp, 9 bytes $|$&*aUWb Attempt This Online! Or, verify all test cases. Explanation ...
user avatar
  • 31.8k
2 votes

Crossing a Lily Pond

C++ (GCC), 95 94 bytes int f(auto p,int s){int i=s,j,a,r=0;for(;a=i;r|=a)for(j=--i;j<p.size();j+=s)a&=p[j];return r;} input: ...
user avatar
13 votes

Crossing a Lily Pond

BitCycle, 329 bytes BitCycle is certainly not an easy language to solve this in, despite the fact that its only form of data (streams of bits), easily represents the pattern of the lilypond in this ...
user avatar
  • 1,700
2 votes

Crossing a Lily Pond

Wolfram Language (Mathematica), 44 bytes Length[{}⋃Flatten@#~Position~0~Mod~#2]<#2& Try it online!
user avatar
  • 4,206
1 vote

Crossing a Lily Pond

Desmos, some bytes ...
user avatar
  • 529
5 votes

Crossing a Lily Pond

Desmos, 85 62 bytes f(l,s)=max(0,sign(s-mod([1...l.length][l=0],s).unique.length)) -23 bytes thanks to Aiden Chow Try it on Desmos!
user avatar
  • 4,206
4 votes

Crossing a Lily Pond

Java (JDK), 67 bytes (j,l,s)->{int r=1<<j;for(l|=--r>>s%j<<s;l>0;l>>=j)r&=l;return r>0;} Try it online! Takes input as three <...
user avatar
0 votes

iHateOddNumbers

Re:direction, 11 bytes ++>> + v < Try it online! The input number n is represented in the queue as n >s followed ...
user avatar
  • 5,486
5 votes

Crossing a Lily Pond

R, 37 36 34 bytes Edit: -2 bytes thanks to Giuseppe function(x,y)(y:0)[1:y*-!c(x,1:y)] Try it online! Outputs zero for falsy, and a vector with non-zero first ...
user avatar
3 votes

Crossing a Lily Pond

Minecraft Command Blocks, 403 bytes The commands in the command blocks from left to right: ...
user avatar
  • 429
2 votes

Crossing a Lily Pond

Perl 5 -pl, 49 bytes $l=<>-1;$_=/^.{0,$l}(.{$l}1)+.{0,$l}$/||$l>=y///c Try it online!
user avatar
  • 12.4k
4 votes

Crossing a Lily Pond

HBL, 19 bytes ?('?,)1(1,)('?.(2., +(*(),(<2(*-(0,)). Takes two arguments: a list of 1s and 0s, and an integer. Returns 0 for falsey and a nonzero integer for ...
user avatar
  • 31.8k
4 votes

Crossing a Lily Pond

05AB1E, 5 bytes ι€ßĀà First input is the jump-distance, second the string of water/lilies with 0/...
user avatar
1 vote

Safety in numbers

Vyxal, 10 bytes ƛ?=T¯‹≤A;A Try it Online! ...
user avatar
  • 27.6k
1 vote

iHateOddNumbers

Minecraft Command Blocks, 288 bytes The commands in command blocks from left to right: ...
user avatar
  • 429
4 votes

Crossing a Lily Pond

C(GCC), 105 99 bytes -6 bytes thanks to @ceilingcat, but I want to keep the inside while ...
user avatar
  • 71
2 votes

Crossing a Lily Pond

Charcoal, 14 bytes Nθ¬⌊Eθ№✂ηιLηθ0 Try it online! Link is to verbose version of code. Takes the jump size as the first parameter and the pond as the second ...
user avatar
  • 143k
1 vote

Crossing a Lily Pond

Retina 0.8.2, 62 bytes .+$ $* ^(?=.*¶1(1)*)(?<-1>.)*((?(3)^)1(?=.*¶1(1)*)(?<-3>.)*)*¶ Try it online! Takes pond and jump size on separate lines but ...
user avatar
  • 143k
3 votes

Crossing a Lily Pond

Retina, 48 bytes ~(L$`.+$ * C`\B .+ ^(^.{0,$&}1|$&*.1)$*.{0,$&}\n Try it online! Takes pond and jump size on separate lines but link is to test suite ...
user avatar
  • 143k
3 votes

Is it an elementary matrix?

Desmos, 117 bytes K=[0...W^2] J=K[(L-0^{mod(K,W+1)})^2>0] n(L)=L.length f(L,W)=\{n(J)<2,32=n(\mod(J,W).\unique)^23^{L[J+1]^2}.\total\} This turned out ...
user avatar
  • 15.9k
7 votes

Crossing a Lily Pond

R, 64 bytes function(x,y)length(table(which(strsplit(x,'')[[1]]=='0')%%y))<y Try it online! If allowed to take a boolean list instead: R, 42 bytes ...
user avatar
  • 621
3 votes

Crossing a Lily Pond

J, 19 16 bytes [>#@~.@(|[:I.-.) Try it online! -3 taking the approach from Unrelated String's jelly answer original answer J, 19 bytes ...
user avatar
  • 26.6k
3 votes

Crossing a Lily Pond

Factor, 52 bytes [| s n | n 1 s indices [ n mod ] map cardinality > ] Try it online! Port of Unrelated String's first Jelly answer. ...
user avatar
  • 8,908
4 votes

Crossing a Lily Pond

Vyxal r, 6 bytes T%UL⁰> Try it Online! Port of Jelly answer. How? ...
user avatar
  • 4,206
11 votes
Accepted

Crossing a Lily Pond

Jelly, 5 bytes T%QL< Try it online! Look ma, no Unicode! Takes a list of 0 for lilies and 1 for water on the left, and the stride on the right. ...
user avatar
2 votes

Crossing a Lily Pond

JavaScript (ES6), 52 bytes Expects (distance)(string). (n,k=n)=>g=s=>k--&&[...s].every((x,i)=>i%n|x)|g(1+s) ...
user avatar
  • 166k
5 votes

Crossing a Lily Pond

Python, 62 47 46 bytes thanks to @Unrelated String for the idea of alternative input format -1 byte thanks to @dingledooper f=lambda p,n:0in(0in p[i::n]for i in range(n)) Attempt This Online! C (gcc), ...
user avatar
  • 1,282
1 vote

Is It A Rainbow Color?

Wolfram Language (Mathematica), 31 bytes StringPosition[#,"ro"|"p"|"c"]& Try it online! Boring, but valid.
user avatar
  • 1,270
1 vote

Is this number a prime?

rSNBATWPL, 49 bytes print{n=input{};(i~cond{n%i}{{i- 1}}$i*i<2)$n- 1} Recursive solution, as a full program. As a function, it's 34: ...
user avatar
0 votes

Numbers with Rotational Symmetry

Wolfram Language (Mathematica), 56 bytes #~ContainsNone~{2,3,4,5,7}&&Reverse@#==(#/.{6->9,9->6})& Try it online! Takes input as a list of digits. ...
user avatar
  • 1,270
1 vote

Numbers with Rotational Symmetry

Julia 1.0, 45 bytes !x=prod(d->"01....9.86"[1+d],digits(x))=="$x" Try it online!
user avatar
  • 4,824
1 vote

Numbers with Rotational Symmetry

Nobody had posted a Python 3 solution so I'll go with my rubbish one Python 3, 190 95 bytes ...
user avatar
  • 529
1 vote

Are All the Items the Same?

Ly, 6 bytes a0I=u; Try it online! This one works by sorting the list of number and comparing the top and bottom of the stack. ...
user avatar
  • 1,859
2 votes

Check if a matrix is Zarankiewicz-maximal

Desmos, 247 241 bytes ...
user avatar
  • 15.9k
1 vote

Are All the Items the Same?

Batch, 93 bytes @set i=%1 :l @if %i:~,1%==%i:~-1% (if %i% gtr 9 (set/ai=%i%/10&goto:l)else echo 1)else echo 0 Takes input from the command line as a string of ...
user avatar
  • 1,851

Top 50 recent answers are included