46
votes
Scroll Word's font size selector
Word VBA, 199 147 126 116 102 100 87 85 Bytes
Why emulate when you can do?!
Declared function in the ThisDocument module that takes input ...
44
votes
31
votes
Bit run rundown
Python 2, 46 45 bytes
f=lambda n,k=1:`k`in bin(n^n/2)and-~f(n,k*10)
Try it online!
How it works
By XORing n and n/2 (dividing by 2 essentially chops off the ...
31
votes
Speed of Lobsters
convey, 59 47 bytes
{
?;\,&:1<
v^<^ ,<$1
"=>^}"@"}
>">>#="
'*'>:<=0
Try it online!
Run with ...
29
votes
Is there a single straight line in the matrix?
Python 2, 49 bytes
Takes as input a 2D binary matrix \$ a \$, and its size \$ n \$.
lambda a,n:sorted(map(sum,a+zip(*a)))[-2:]==[1,n]
Try it online!
There may be ...
25
votes
Universal Spooky Meme Translator
Ruby, 50 44 43 bytes
FGITW answer. Gotta go fast!
Thanks to @Neil for saving 6 bytes.
Oh right, crossed out 44 is still 44
...
24
votes
Make me a metasequence
Wolfram Language (Mathematica), 34 bytes
0~Range~19~Binomial~i~Sum~{i,0,#}&
Try it online!
The tier \$n\$ metasequence is the sum of the first \$n+1\$ ...
21
votes
Backronymiser឵឵
C (gcc), 49 bytes
f(char*a,char*t){for(;*a;)*a++^=*a-*t?0:32+!++t;}
Try it online!
Modifies a in place. Input ...
19
votes
Make me a metasequence
Haskell, 34 bytes
(iterate(init.scanl(+)1)[1..20]!!)
Uses 0-indexed inputs (f 4 returns tier 5.)
Haskell, 36 bytes
...
17
votes
Bit run rundown
Python 2, 46 bytes
f=lambda n,r=1:max(r,n and f(n/2,1+~-n/2%2*r))
Try it online
Extracts binary digits from n in reverse by ...
17
votes
Longest Zero Sum Sub-array
Python 3, 47 bytes
f=lambda x,*a:f(*a,x[1:],x[:-1])if sum(x)else x
Try it online!
It's simple breadth-first search, implemented recursively. The ...
16
votes
Speed of Lobsters
JavaScript (ES6), 35 bytes
Expects (haystack)(needle), where haystack is a list of characters and ...
16
votes
What's my TIO uniqueness?
JavaScript (Node.js), 819 779 bytes
Returns 0 for undefined TIO uniqueness.
...
15
votes
Universal Spooky Meme Translator
Perl, 36 34 bytes
s/\d+/"0|$&$^I"=~s#\^#**#r/gee
The source code is 30 bytes long and it requires the switches -pi (+4 ...
15
votes
All the k-mers/n-grams
Jelly, 1 byte
ṡ
Jelly has a single byte dyadic atom for this very operation
Try it online! (the footer splits the resulting list with newlines, to avoid a ...
15
votes
14
votes
14
votes
Even sum subarrays
Python 3.8 (pre-release), 57 bytes
f=lambda S,p=1:S>[]and f(S[1:])+sum((p:=p^s%2)for s in S)
Try it online!
Similar to brute-force method below but should have ...
14
votes
Check if the string is reshaped
Retina, 10 bytes
^(.+).*\1$
Try it online!
Works in any flavor of regex that supports backreferences.
14
votes
Output every sublist ... eventually
Haskell, 31 27 bytes
-4 bytes thanks to Wheat Wizard!
Takes an infinite list as input and returns each finite sublist an infinite number of times.
...
13
votes
Is it a circumfix?
J, 23 21 20 bytes
>&#*]e.1}:@}.-&#]\.[
Try it online!
-1 byte thanks to Bubbler
Return true if:
>&# left ...
13
votes
cadaddadadaddddaddddddr - linked list accessing
JavaScript (V8), 48 bytes
a=>f=b=>b[2]?b[[x,...r]=f(b.slice(1)),1]<f?x:r:a
Try it online!
-2 bytes thanks to @Arnauld!
13
votes
Count the shared substrings with 2 programs
Python, score 0, 520 bytes
-25 from @Grain Ghost
-78 from @Jonathan Allan
-61 from @RootTwo
-4 from @Grain Ghost
...
12
votes
Fractal Smoke Sequence
Python 2, 95 bytes
l=[];n=input()
exec"a=min(set(range(n))-{2*b-c for b,c in zip(l,l[1::2])});print-~a;l=[a]+l;"*n
The main trick is in generating the ...
12
votes
Accepted
12
votes
Subsequence Substitution
Python 2, 88 bytes
def f(a,b,c,o=""):
for q in a:x=q==b[:1];o+=c[:x]or q;b=b[x:];c=c[x:]
print[o,a][c>'']
A function that takes in the three strings and ...
12
votes
Scroll Word's font size selector
JavaScript (ES6), 103 101 bytes
Takes input as an array of -1 / 1.
...
12
votes
Column-wise summation of overlapping slices
J, 11, 9 8 bytes
-1 byte thanks to miles!
[:+//.]\
How it works?
The left argument is s, the right one - L
]\ - splits L ...
12
votes
Playing with the musical turtle
Java 8, 48 39 33 bytes
s->"ROYGBRO BGYORBG".indexOf(s)|7
-6 bytes thanks to @RickHitchcock, so make sure to upvote him as well!
Takes uppercase color ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
subsequence × 118code-golf × 110
string × 41
sequence × 32
array × 17
decision-problem × 15
number × 11
integer × 8
fibonacci × 7
math × 6
fastest-algorithm × 5
arithmetic × 4
binary × 4
combinatorics × 3
matrix × 3
base-conversion × 3
counting × 3
set-partitions × 3
kolmogorov-complexity × 2
number-theory × 2
primes × 2
quine × 2
sorting × 2
optimization × 2
palindrome × 2