Hot answers tagged

30 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Python,  55  51 bytes lambda a:'%x'%(-int(a.replace('c','0c'),16)%255-39) Attempt This Online! Explain: Observe that 'a', 'b', 'c' are base 16 digits. I learnt ...
Phan Trọng Nhân's user avatar
18 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

JavaScript (ES6), 59 bytes s=>(s+"aaabbabbc").replace(q=/c|../g,s=>(q[s]^=1)?o=s:0)&&o Try it online! Commented ...
Arnauld's user avatar
  • 188k
15 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Stax, 11 bytes ù¢╓┘0ï<ΣEZ1 Run and debug it Unpacked (13 bytes): 'c|^2/M{{SkmT Explanations: ...
jimmy23013's user avatar
  • 36.9k
11 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Jelly, 15 14 bytes ḟ”cQp`ḟs2$Ʋȯ”c Try it online! Thanks to @JonathanAllan for saving a byte! A full program taking a string as its argument and printing the ...
Nick Kennedy's user avatar
  • 18.9k
10 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Python, 55 bytes lambda a:f'{int("cc"+(30*a).strip("ab"),16)%255%192:x}' Attempt This Online! This produces 15 (= base - 1) on frame and (if <...
Albert.Lang's user avatar
  • 2,259
9 votes

Just another traffic jam!

Jelly, 3 bytes ŒgZ A full program that accepts a pair of the two strings as the first argument and prints the resulting single lane. Try it online! How? ...
Jonathan Allan's user avatar
7 votes

Literate Programming in Base 26

Jelly, score 23 The bijective base \$26\$ program as words: yrs seo dts i am a be in cpu sap The Jelly code: ÑÞ²¶O_96ḅ26ḃ⁹’ ...
Jonathan Allan's user avatar
6 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Vyxal, 106 bitsv2, 13.25 bytes ‛ab2↔\cpṖ'ḣ∑?=;hh Try it Online! Bitstring: ...
lyxal's user avatar
  • 32.5k
6 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

J 9.4, 25 bytes (]>.&XOR&.dfh _2]\-.)&'c' Attempt This Online! dfh and hfd ...
Bubbler's user avatar
  • 73.8k
6 votes

Just another traffic jam!

Ruby, 33 bytes f=->a,b{a[/(.)\1*/]?$&+f[b,$']:b} Try it online! How it works: If the first queue is not empty, extract the first vehicle, then exchange the ...
G B's user avatar
  • 21.3k
5 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

TypeScript's Type System, 144 bytes ...
noodle man's user avatar
  • 5,262
5 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Jelly,  20 18  17 bytes -3 thanks to Nick Kennedy reminding me to golf the magic table. ⁾abp`”cṭŒ!F=¥Þ⁸ṪṪ A full program that accepts the flattened, redacted ...
Jonathan Allan's user avatar
5 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Ruby, 41 bytes ->s{"%x"%(726-s.scan(/c|../).sum(&:hex))} Try it online! 0xaa+0xab+0xba+0xbb+0xc is 726.
G B's user avatar
  • 21.3k
4 votes

"Hello, World!"

Vyxal 3, 8 bytes "Ḍᵗ{w<ᵏ” Try it Online! Vyxal 3 just dropped.
lyxal's user avatar
  • 32.5k
4 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Retina 0.8.2, 29 23 bytes $ ¶aaabbbbac D`c|.. 1A` Try it online! Link includes test cases. Explanation: $ ¶aaabbbbac Append ...
Neil's user avatar
  • 166k
4 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Go, 209 bytes ...
bigyihsuan's user avatar
  • 8,548
4 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Uiua, 31 29 bytes Two bytes saved by replacing "ab" with ⊝. ...
Pseudo Nym's user avatar
4 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Uiua, 27 bytes ?"c"⍜(-@a)(◿2/+↯~2▽<2.)=8⧻. Try it online! Explanation: For the cases where 'c' is in the string, this uses a little trick by ...
Matthew Wilson's user avatar
4 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Perl 5 (-p), 32, 29 bytes $_=s/c//?eval s/..\K\B/^/gr:c Try it online! If c can't be ...
Nahuel Fouilleul's user avatar
4 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Java (SE), 164 bytes ...
Tobias321's user avatar
  • 141
4 votes

Just another traffic jam!

05AB1E, 5 bytes €γõζS Input as a pair of strings; output as a list of characters. Try it online or verify all test cases. Explanation: ...
Kevin Cruijssen's user avatar
4 votes

Just another traffic jam!

Uiua, 16 bytes ⊐/⊂♭⍉⬚∘⊟□[]∩⊜□∩. Try it! Takes lists of postive integers as input (because this saves a few bytes over strings). ...
chunes's user avatar
  • 22.7k
3 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Python, 83 bytes lambda a:min({'aa','ab','bb','ba','c'}-{a.replace('c','')[i:i+2]for i in[0,2,4,6]}) Attempt This Online! -17 bytes thanks to Neil
mousetail's user avatar
  • 11.8k
3 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Charcoal, 19 15 bytes ⌊⁻⪪”&∨O⊕”²⪪⁻Sc² Try it online! Link is to verbose version of code. Explanation: ...
Neil's user avatar
  • 166k
3 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Ruby, 64 bytes ->s{a=%w[aa ab ba bb c];a.find{[*(a-[_1]).permutation].join[s]}} Attempt This Online!
Kirill L.'s user avatar
  • 13.7k
3 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Python 3.8, 82 bytes lambda a:("cbbaa"*469)[(k:=sum(map(ord,(r:=a.replace('c',''))+r[::2])))::k][r==a:] An unnamed function that accepts the flattened, ...
Jonathan Allan's user avatar
3 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Google Sheets, 80 bytes =substitute(regexreplace("aa|ab|ba|bb|c",regexreplace(A1,"(c|..)","$1|"),),"|",) Put the input in ...
doubleunary's user avatar
3 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Python 3, 73 bytes b,*l=0,{'c'},{0} for c in input():l[b]^={c};b^=c<'c' print(str(l)[3::10]) Try it online! 71 bytes ...
xnor's user avatar
  • 144k
3 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

J, 31 30 29 bytes (e.~{];,@{@;[email protected]._2<\-.)&'c' Try it online! -1 thanks to ovs ,@{@;~@-. All valid 2 char pairs, ...
Jonah's user avatar
  • 33k
3 votes

aaabbabbc⠀⠀⠀⠀⠀⠀

Python, 86 bytes lambda s:[*{'aa','ab','ba','bb'}-{*map(str.__add__,*[filter('c'.__ne__,s)]*2)},'c'][0] Attempt This Online! No magic numbers here, just another ...
ShadowRanger's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible