12 votes

Strings without twin letters

Husk, 4 bytes fΛ≠π Try it online! Short and straightforward solution, the MVP here is Λ, thanks to its overload that can take a ...
Leo's user avatar
  • 12.6k
10 votes

Enumerate the Phat-fingered-lights-out numbers

Uiua 0.9.0, 14 bytes SBCS (updated!) ↙:▽=0/-⍉⋯.⇡×.. Try on Uiua Pad! Takes \$n\$ as input and outputs the first \$n\$ terms. Does essentially the same thing as my ...
Tbw's user avatar
  • 1,139
8 votes
Accepted

Compiler for LaTeX

Tamsin, 375 220 211 bytes ...
Mukundan314's user avatar
  • 8,204
8 votes

Strings without twin letters

Google Sheets, 88 bytes =let(L,torow(A:A,1),reduce(,sequence(B1),lambda(a,_,sort(tocol(if(left(a)=L,,L&a),1))))) Put letters \$L\$ in column ...
doubleunary's user avatar
  • 1,388
6 votes

Enumerate the Phat-fingered-lights-out numbers

Jelly, 6 bytes Bḅ-¬µ# A full program that accepts a positive integer, n, on stdin and prints the first ...
Jonathan Allan's user avatar
6 votes

Strings without twin letters

Haskell, 49 47 bytes l#1=pure<$>l l#n=[c:a:r|a:r<-l#(n-1),c<-l,a/=c] Try it online! Edit: Thanks to @xnor for taking off two bytes! I didn't know you ...
colossus16's user avatar
  • 1,851
6 votes

Strings without twin letters

Ruby, 42 bytes ->l,n{(?A*n..?Z*n).grep_v /[^#{l}]|(.)\1/} Attempt This Online! Input in uppercase. Start with a list of all \$n\$-letter strings, then remove ...
Dingus's user avatar
  • 11.1k
5 votes

Enumerate the Phat-fingered-lights-out numbers

JavaScript (V8), 45 bytes A full program that prints the sequence indefinitely. This relies on arithmetic underflow to stop the recursion, making it slower than it should (+1 byte for a faster version)...
Arnauld's user avatar
  • 191k
5 votes

Enumerate the Phat-fingered-lights-out numbers

Charcoal, 23 19 16 bytes NθI…Φ×θθ¬↨↨ι²±¹θ Try it online! Link is to verbose version of code. Outputs the first n terms. ...
Neil's user avatar
  • 169k
5 votes

Compute the phat-fingered double-bit-flip distance

Charcoal, 51 bytes NθNηW⁻θη¿﹪鲫≔³ζW∧&θζ&~θζ≦⊗ζ≔⁻|θζ&θζθ→»«≧÷²θ≧÷²η»Iⅈ Try it online! Link is to verbose version of code. Explanation: Greedy algorithm which works ...
Neil's user avatar
  • 169k
5 votes

Strings without twin letters

Vyxal, 5 bytes ↔'ÞǓ⁼ Try it Online! generates all combinations of length n using the characters in the input string, then filters by those which are equal to the ...
pacman256's user avatar
  • 3,330
5 votes

Swap letter cases

MATL, 2 bytes Yo Try it at MATL online!
Luis Mendo's user avatar
  • 104k
5 votes

Swap letter cases

Python 3, 47 bytes lambda s:[chr(ord(c)^32*c.isalpha())for c in s] Try it online!
Alan Breadel's user avatar
  • 3,893
4 votes

Enumerate the Phat-fingered-lights-out numbers

APL(Dyalog Unicode), 18 bytes SBCS Requires Index Origin 0 (...
Mukundan314's user avatar
  • 8,204
4 votes

Strings without twin letters

JavaScript (ES10), 54 bytes Expects (a)(n), where a is an array of characters. Returns an array of strings. ...
Arnauld's user avatar
  • 191k
4 votes

Compute the phat-fingered double-bit-flip distance

Python3, 56 bytes p=lambda a,b,c=0:abs(c)+(a^b and p(b//2,a//2,c+a%2-b%2)) Thanks to @loopy walt for an elegant way to remove the mask completely by alternating ...
Vincent's user avatar
  • 41
4 votes

Strings without twin letters

Python 3, 74 67 64 bytes -7 thanks to @Albert.Lang, -3 thanks to @Mukundan314 f=lambda l,n:[""][n:]or[c+w for w in f(l,n-1)for c in{*l}-{*w[:1]}] Try it ...
Arnold Palmer's user avatar
4 votes

Strings without twin letters

MATL, 9 bytes Z^t!dXAY) Try it online! Explanation ...
Luis Mendo's user avatar
  • 104k
4 votes

Strings without twin letters

C (gcc), 168 160 119 114 bytes -8 Thanks to @corvus_192 for pointing out newline separation between values was allowed, and a massive -41 thanks to @tsh, a further -5 thanks to @ceilingcat ...
Arnold Palmer's user avatar
4 votes

Strings without twin letters

K (ngn/k), 22 21 bytes: -1 byte due to @ovs. {(+j)@&~|/=':j:!y#,x} Try it online
akamayu's user avatar
  • 61
4 votes

Swap letter cases

C (gcc), 40 bytes f(char*s){if(*s^=isalpha(*s)/32)f(s+1);} Try it online! C (gcc), 45 42 bytes ...
Mukundan314's user avatar
  • 8,204
4 votes

Swap letter cases

J, 16 14 bytes 3!:12"+~'`'&I. NOTE: fails on ATO's older J but works in j9.4.2 -9 thanks to ovs!! -2 thanks to Bubbler for a very nice refinement! The ...
Jonah's user avatar
  • 33.3k
4 votes

Swap letter cases

K (ngn/k), 20 bytes {`c$(_x)-32*~"a{"'x} Try it online! Lowercase the entire string using the builtin _ and then ...
Bubbler's user avatar
  • 75k
3 votes

Find the Chess960 starting positions from its integer ID

APL+WIN, 146 bytes. Prompts for layout number. Uses compressed versions of the bishops' and knights' tables. ...
Graham's user avatar
  • 5,866
3 votes

Compute the phat-fingered double-bit-flip distance

JavaScript (ES6), 63 bytes A port of Neil's greedy algorithm. Expects (a)(b). ...
Arnauld's user avatar
  • 191k
3 votes

Enumerate the Phat-fingered-lights-out numbers

x86 32-bit machine code, 23 bytes 83 C8 FF 40 BA AA AA AA AA 31 C2 F3 0F B8 D2 83 FA 10 75 EF E2 ED C3 Try it online! Following the ...
m90's user avatar
  • 10.1k
3 votes

Strings without twin letters

APL+WIN, 42 bytes Prompts for string followed by n: n←m←⎕⋄⍎∊(⎕-1)⍴⊂'n←n∘.,m⋄'⋄(0=+/¨2=/¨,n)/,n Try it online! Thanks to Dyalog Classic
Graham's user avatar
  • 5,866
3 votes

Strings without twin letters

Uiua SBCS, 23 21 20 bytes ▽≡(/×≡/≠◫2).⊏☇1⇡▽:⧻, Try it! ...
chunes's user avatar
  • 23.4k
3 votes

Strings without twin letters

Excel ms365, 85 84 bytes -1 thanks to doubleunary's tip to apply LEFT() instead of RIGHT(). Assuming: \$L\$ - Given input in ...
JvdV's user avatar
  • 3,613
3 votes

Strings without twin letters

Jelly, 6 bytes ṗnƝẠ$Ƈ A dyadic Link that accepts the alphabet on the left and the word length on the right and yields a list of valid words. Try it online! How? <...
Jonathan Allan's user avatar

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