12
votes
Reconstruct an array by successive insertions
05AB1E, 11 bytes
η@O<ø{.γн}¦
Try it online!
Takes a list of numbers, 0 to 14, with o being 0, and ...
11
votes
I (rev)?(pal)? the source code, you (rev)?(pal)? the input!
Charcoal, 3 bytes
θ⮌ω
Try it online! Reversed:
ω⮌θ
Try it online! Palindromised:
θ⮌ωω⮌θ
...
8
votes
Implement Subleq
Python 3, 58 bytes
def f(s,i=0):a,b,*r=s[i:];s[b]-=s[a];f(s,[i+3,*r][s[b]<1])
A recursive function that updates a Subleq program, the list of integers ...
8
votes
Do you win a Numeric Mahjong?
05AB1E, 47 47 44 41 38 bytes
œʒ3ôʒ¥J>}gy3ôʒ¥T>SQ}g+3*Ig>Q}ćQ,¥›HUyy
Try it online!, or try all test cases (this code can handle in under a minute).
See ...
8
votes
I (rev)?(pal)? the source code, you (rev)?(pal)? the input!
JavaScript, 70 bytes
(x=>x.at?x:y=>y+z(y))//)y+)y(z>=y:``nioj.)(esrever.]x...[?ta.x>=x=z(
Try it online!
7
votes
Reconstruct an array by successive insertions
Vyxal, 11 bytes
14ʁṘ(n~=T,o
Try it Online!
Takes a list of numbers, outputs 14 arrays containing the indices from n to ...
7
votes
Reconstruct an array by successive insertions
R, 41 bytes
\(x)Map(\(i)which(x[x<=i]==i)-1,1:max(x))
How?
...
7
votes
I (rev)?(pal)? the source code, you (rev)?(pal)? the input!
05AB1E, 3 bytes
?R\
?R\ - Try it online.
\R? - .enilno ti yrT
...
6
votes
Do you win a Numeric Mahjong?
JavaScript (ES6), 143 122 119 bytes
-24 bytes thanks to @tsh!
Expects an Uint32Array. Returns a Boolean value.
...
5
votes
Print every character your program doesn't have
Vyxal, 11 bytes
I don't think I saw any Vyxal on here! Prints all printable ASCII with kQ and filters chars out with F
kQ`\kQF\``F
Try it Online!
5
votes
Print a 10 by 10 grid of asterisks
makina, 51 bytes
v ;0n<ICU
>P>>>u?e
^>t>JUOO**********;
^<<<<<<>n9;
I AM TOAST SMEAR ME WITH BUTTER
5
votes
Reconstruct an array by successive insertions
JavaScript (ES6), 67 bytes
Expects an array of integers in \$[1\dots15]\$. Returns an array of 14 arrays containing the insertion indices.
...
5
votes
Print a 10 by 10 grid of asterisks
Trilangle, 35 bytes
Control flow: yes.
'8_',o9\v*<'.(".^(#/>o.<>,<..\()@#(
zelda
5
votes
I (rev)?(pal)? the source code, you (rev)?(pal)? the input!
Python, 53 bytes
-2 bytes, thanks to tsh
s=input()#
print(end=s)#)]1-::[s=dne(tnirp
#)(tupni=s
reads from standard input
Attempt This Online!
Python, 55 bytes
<...
5
votes
I (rev)?(pal)? the source code, you (rev)?(pal)? the input!
R, 92 bytes
x=el(strsplit(scan(,''),''))#
cat(x,sep='')#)''=pes,)x(ver(tac
#))'',)'',(nacs(tilpsrts(le=x
Attempt This Online!
Full program that reads input from ...
4
votes
Implement Subleq
JavaScript (ES6), 57 bytes
Modifies the input array.
f=(m,p=0)=>1/m[p]&&f(m,(m[m[p+1]]-=m[m[p]])>0?p+3:m[p+2])
Try it online!
Commented
...
4
votes
4
votes
Implement Subleq
x86(-64) machine code, 17 bytes
A function that simulates a SUBLEQ machine with 8-bit cells, returning to the caller with the array modified. Callable from C with the x86-64 SysV calling convention ...
4
votes
I reverse the source code, you reverse the input!
J 9, 4 bytes
][.|
Attempt This Online!
See this answer for the 7-byter that works in previous versions.
J 9 (re-)introduces modifier trains and adds some adverb ...
4
votes
4
votes
Do you win a Numeric Mahjong?
Charcoal, 128 125 122 bytes
¿⁼²﹪L賫≔⟦⟧η≔⟦⟧ζW⌊⁻θη«⊞ηι⊞ζ⟦ι№θι⟧»⊞υζFυ¿⁼¹LΦι﹪§κ¹↔³P¹Fη¿⁼³LΦι×§λ¹›²↔⁻κ§λ⁰⊞υEι⟦§λ⁰⁻§λ¹›²↔⁻κ§λ⁰⟧»W›ηη«⊞⊞⌊⌊№№≔Φ﹪××⁻⁻¹EEFPPW∕»
Try it ...
4
votes
Reconstruct an array by successive insertions
Python 3, 74 bytes
f=lambda x:sorted((i,sum(j<=i for j in x[:n]))for n,i in enumerate(x)if i)
Takes input as integers:
...
4
votes
I (rev)?(pal)? the source code, you (rev)?(pal)? the input!
Vyxal, 3 bytes
₴Ḃ_
Try!
!yrT
Try!!yrT
!yrTTry!
+1 very hard
You uh sure about that?
Explained
...
3
votes
Find the largest sum such that no two elements are touching
Scala 3, 69 bytes
l=>{val(a,b)=l.foldLeft((0,0)){case((a,b),c)=>(a max b,a+c)};a max b}
Attempt This Online!
3
votes
Find the largest sum such that no two elements are touching
JavaScript (Node.js), 39 bytes
a=>a.map(v=>q=(v+=p)>(p=q)?v:p,p=q=0)|q
Try it online!
Use two variables p, and ...
3
votes
Find the largest sum such that no two elements are touching
Java, 64 57 bytes
a->{int t=0,r=0;for(int k:a)r=(k+=t)>(t=r)?k:t;return r;}
Another port of @G B's Ruby answer.
Also runs in \$O(n)\$ complexity.
Try it ...
3
votes
Don't google "google"
Vyxal, 8 bytes
ɽ‛»¾=ßṀL
Assumptions
Program itself is the function g
Program takes exactly one input
"Google" being in the code page dictionary allows ...
3
votes
Find the largest sum such that no two elements are touching
Befunge-98 (PyFunge), 60 67 bytes
Rearranged Version, saves 7 bytes
<v&v#gf;#e_f#;<j4`gffgfe<pff0pfe0
.>#<ffg+efpffp ^@
Try it online!
...
3
votes
Hello world!!! Fibonacci distribution
Vyxal Ṫ, 8+13=21 bytes
kh6⁽NV33C3ẋ#123456789
kh6⁽NV = Hello world
33C = ASCII 33 to !
3ẋ = repeat top of stack three times
(...
3
votes
Reconstruct an array by successive insertions
Charcoal, 22 bytes
⊞υoW⌊⁻θυ⟦ιI⌕A⁻θ⁻θ⊞Oυιι
Try it online! Link is to verbose version of code. Explanation:
⊞υo
Start as if <...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
code-golf × 11749string × 2065
math × 1581
number × 1202
ascii-art × 1147
sequence × 838
array × 758
decision-problem × 710
kolmogorov-complexity × 625
arithmetic × 504
number-theory × 421
integer × 396
grid × 343
geometry × 336
random × 318
tips × 315
combinatorics × 305
primes × 296
matrix × 281
date × 265
graphical-output × 264
game × 233
parsing × 230
binary × 213
restricted-source × 201