Skip to main content

New answers tagged

0 votes

Find characters common among all strings

Arturo, 68 bytes $->L->join map unique L\0'a->repeat a min map L=>[enumerate&=>[&=a]] Try it! A port of Nicola Sap's Python answer. Takes ...
chunes's user avatar
  • 24.6k
0 votes

Build the first 6 letters of an Italian codice fiscale (tax identification number)

sed -r, 125 bytes Expecting all-uppercase input ...
Jan Blumschein's user avatar
1 vote

Find characters common among all strings

Perl 5 -MList::Util=min,pairmap -plF, 77 bytes ...
Xcali's user avatar
  • 15.3k
2 votes

Just another traffic jam!

R, 155 bytes ...
int 21h -- Glory to Ukraine --'s user avatar
1 vote

Interleaving reversing

Uiua SBCS, 7 bytes ⍜▽⇌◿2°⊏ Try it! ...
chunes's user avatar
  • 24.6k
2 votes

Interleaving reversing

R, 76 bytes \(S)cat(substring(S,s<-ifelse((a=1:(n=nchar(S)))%%2,a,n-n%%2+2-a),s),sep="") Attempt This Online! In this solution I have used a vector of ...
int 21h -- Glory to Ukraine --'s user avatar
0 votes

Break a word into vowels and consonants

sed, 33 bytes h s/[^aeiou]//gip g s/[aeiou]//gi Try it online! Outputs two strings on separate lines. Bash (+sed), 39 bytes ...
Jan Blumschein's user avatar
1 vote

Convert YYYYMM to MMMYY

J types/datetime, 52 bytes 2 3&{,~'MMM'toupper@fmtDate 1800 todayno@,1,~4".@}.] A solution using one of J's libraries. ...
south's user avatar
  • 1,800
1 vote

Convert YYYYMM to MMMYY

TypeScript's type system, 231 bytes ...
noodle person's user avatar
1 vote

Convert YYYYMM to MMMYY

Uiua, 54 23 bytes ⊂⊡:⌵≡◇↙3Months-1⋕⊃↘↙⟜↘2 Try it online TIL Uiua has a Months constant, thanks chunes
noodle person's user avatar
2 votes

Convert YYYYMM to MMMYY

Zsh + BSD/MacOS date, 40 bytes <<<${(U)$(date -jf %Y%m 20${1:2} +%b%y)} It works for BSD ...
roblogic's user avatar
  • 2,944
1 vote

Convert YYYYMM to MMMYY

R, 61 bytes toupper(format(as.Date(paste0(scan(,""),1),"%Y%m%d"),"%b%y")) Try it online! R, 62 bytes (a former version featuring an ...
int 21h -- Glory to Ukraine --'s user avatar
0 votes

Sum of Positive and Negative Powers of 2

Python + gmpy2   2.1.5 ...
138 Aspen's user avatar
  • 5,991
1 vote

Find characters common among all strings

Zsh & coreutils, 110 93 bytes d()(<<<$1|fold -1|sort) m=$1;while ((#>1))do m=`comm -12 <(d $m) <(d $2)`;shift;done <<<$m|rs Try it ...
roblogic's user avatar
  • 2,944
1 vote

Build the first 6 letters of an Italian codice fiscale (tax identification number)

Bash, 234 bytes ...
Themoonisacheese's user avatar
0 votes

Find characters common among all strings

05AB1E, 9 bytes ε{æ}.»Ãéθ (Output is sorted.) Try it online or verify all test cases. Explanation: ...
Kevin Cruijssen's user avatar
2 votes

Sum of Positive and Negative Powers of 2

Rust + num_bigint 0.4.5 ...
corvus_192's user avatar
  • 5,482
1 vote

Output the missing integer

R, 31 bytes \(S)(0:9)[!mapply(grepl,0:9,S)] Attempt This Online! I think it's very easy: the range 0..9 is subset by a ...
int 21h -- Glory to Ukraine --'s user avatar
1 vote

Build the first 6 letters of an Italian codice fiscale (tax identification number)

05AB1E, 53 52 bytes #R©¬a®g3@®1èg3‹**>®g‚£íðýlεáΣžMså}ÀDžNÃg4@N*.$Á'x«3£ Outputs as a lowercase pair of 3-char strings. Try it online or verify all test cases. ...
Kevin Cruijssen's user avatar
3 votes

Sum of Positive and Negative Powers of 2

JavaScript (Node.js), ≈3.3ms (1) This hexadecimal version was suggested by tsh Expects a BigInt. This computes hammingweight(XOR(n, 3*n)), as suggested on A007302. ...
Arnauld's user avatar
  • 193k
1 vote

Find characters common among all strings

vemf, 5 bytes Takes a list of strings. ╧û╓¿\ Though vemf has no built-in multiset intersection, it doesn't do too badly, because û is made to implement multiset ...
taswelll's user avatar
  • 151
1 vote

Find characters common among all strings

Uiua SBCS, 17 16 bytes ⍜-(⊚/↧⬚0∵◇°⊚)@\0 Try it! -1 thanks to Tbw
chunes's user avatar
  • 24.6k
2 votes

Find characters common among all strings

Charcoal, 18 bytes WS⊞υιΦθ⬤υ›№λι№…θκι Try it online! Link is to verbose version of code. Takes input as a list of newline-terminated strings. Explanation: ...
Neil's user avatar
  • 172k
4 votes

Find characters common among all strings

R, 49 bytes \(S)Reduce(\(x,y)y[pmatch(x,y,0)],strsplit(S,"")) Attempt This Online! Or alternatively, this 66 bytes version: R, 66 bytes ...
int 21h -- Glory to Ukraine --'s user avatar
2 votes

Find characters common among all strings

R, 81 bytes \(l)rep(y<-unique(el(x<-strsplit(l,""))),Map(\(a)min(sapply(x,\(s)sum(s==a))),y)) Attempt This Online!
pajonk's user avatar
  • 16.7k
1 vote

No strings attached!

Cubical Agda 2.6.5, 591 Bytes Cubical Agda library version a0b4ba3. I use the HEAD version for my convenience, but a standard release version should do. In fact a ...
Trebor's user avatar
  • 735
1 vote

Find characters common among all strings

Haskell, 75 bytes import Data.List f x=[y|y<-mapM(group.sort)x,[z]<-[nub$concat y]]>>=minimum Try it online!
matteo_c's user avatar
  • 6,470
1 vote

Find characters common among all strings

Haskell + hgl, 5 bytes lH nx Fold by multiset intersection. Attempt This Online!
corvus_192's user avatar
  • 5,482
2 votes

Find characters common among all strings

NARS2000 (APL), 3 characters; 6 bytes ∩⍦/ / reduce using   multi-set   ...
Adám's user avatar
  • 30.4k
3 votes

Find characters common among all strings

K(ngn/k), 8 20 10 bytes -10 bytes thanks to ovs. &&/#''=:' Try it here! 20 bytes verison
akamayu's user avatar
  • 511
7 votes

Find characters common among all strings

Python, 65 60 bytes -5 thanks to Jitse (unnecessary generator-to-list inside join(): -2; replace set(X) with ...
Nicola Sap's user avatar
  • 3,685
3 votes

Find characters common among all strings

J, 21 bytes a.#~[:<./+/@(=/&a.)&> Try it online! Takes input as list of boxed words. For each word in the list: For each letter in the word: ...
Jonah's user avatar
  • 33.6k
2 votes

Find characters common among all strings

Retina 0.8.2, 40 bytes %O`. !`(.)(?<=^.*(\1+))(?=.*(¶.*\2.*)*$) Try it online! Takes each string on its own line and outputs each common character in ASCII ...
Neil's user avatar
  • 172k
2 votes

Find characters common among all strings

Vyxal 3 l, 3 bytes /Þ⁾ Try it Online! (link is to literate version) uses literate mode, ends up being a port of jelly anyways ...
pacman256's user avatar
  • 4,105
1 vote

Build the first 6 letters of an Italian codice fiscale (tax identification number)

Charcoal, 82 bytes ≔AEIOUθ≔⪪S η≔⟦⪫⮌E⊕∧⬤§η±¹№αι›³L§η±²⊟ηω⪫ηω⟧ηUMη⭆²Φι∧№αν⁼λ№θν⭆η…⁺Φι∨¬κ∨⊖μ№θ§⁺§η¹AA³X³ Try it online! Link is to verbose version of code. Takes ...
Neil's user avatar
  • 172k
0 votes

Find characters common among all strings

Google Sheets, 279 bytes ...
doubleunary's user avatar
  • 1,705
7 votes

Find characters common among all strings

Jelly, 3 bytes œ&/ Takes a single input argument with a list of strings. Try it online! Explanation Reduce (/) using ...
Luis Mendo's user avatar
  • 105k
2 votes

Find characters common among all strings

JavaScript (ES10), 62 bytes Expects words as arrays of characters and returns in the same format. ...
Arnauld's user avatar
  • 193k
1 vote

Build the first 6 letters of an Italian codice fiscale (tax identification number)

Python, 176 bytes ...
Nicola Sap's user avatar
  • 3,685
4 votes

Build the first 6 letters of an Italian codice fiscale (tax identification number)

Retina 0.8.2, 94 92 bytes (.+?) (..? \w+|\S+)$ $2¶$1 %`\W %O$`([AEIOU])|. $.1 (¶.).(.[^AEIOU]) $1$2 %`$ X %M!`^... ¶ Try it online! Takes input in upper case but ...
Neil's user avatar
  • 172k
5 votes

Build the first 6 letters of an Italian codice fiscale (tax identification number)

JavaScript (ES6), 138 bytes Expects the input in lowercase and returns a string in lowercase as well. ...
Arnauld's user avatar
  • 193k
1 vote

Convert a TIO answer to a CMC answer

Perl 5 + -p0l051, 56 bytes y/[]//d;s/# (\N+bytes?).+ (\N+).+TIO-.+: /$1: [`$2`](/s Try it online!
Dom Hastings's user avatar
  • 23.8k
1 vote

Convert a TIO answer to a CMC answer

TypeScript’s type system, 125 bytes ...
noodle person's user avatar
2 votes

There, I fixed it (with tape)

R, 100 bytes \(S,`!`=utf8ToInt,x=diff(!S)-1)o=Map(\(j,k)cat(intToUtf8(c(rep(!"TAPE",6)[0:j],k))),c(0,x*(x>0)),!S) Attempt This Online! This solution ...
int 21h -- Glory to Ukraine --'s user avatar
1 vote

Cold Bee and Old Beer

jq, 93 bytes . as $L|def m(f):map(select(f|IN($L[])));[m(.[1:]),m(.[:-1])]|combinations|select(.[0]!=.[1]) Attempt This Online! ...
GammaFunction's user avatar
0 votes

Compare two strings, with NaC

JavaScript (Node.js), 86 bytes a=>b=>g(a,0)==g(b)||[g(a,'A')<=g(b,'Z'),g(a,'Z')>=g(b,'A')] g=(a,c)=>a.replace(/1/g,c) Try it online! First check if ...
l4m2's user avatar
  • 24.5k
2 votes

Cold Bee and Old Beer

Dart, 206 204 bytes ...
Redz's user avatar
  • 141
1 vote

Cold Bee and Old Beer

F#, 168 bytes ...
Ciaran_McCarthy's user avatar
0 votes

Break a word into vowels and consonants

PowerShell Core, 50 bytes $args|group{$_-in("aeiou"|% t*y)}|%{-join$_.Group} Try it online! Takes the input string using splatting Returns two strings <...
Julian's user avatar
  • 3,108
1 vote

Break a word into vowels and consonants

J from Jsoftware, 29 bytes (e.(#;]#~[=0:)[)&'aeiouAEIOU' J from Jsoftware, 32 bytes ((e.#[);[#~0:=e.)&'aeiouAEIOU'
scara95's user avatar
  • 21

Top 50 recent answers are included