Skip to main content
4 of 5
added another version
Arnauld
  • 197.7k
  • 20
  • 179
  • 650

#JavaScript (ES6),  92  74 bytes

Takes input as (['gold','silver','bronze'])('rep'). Returns a Boolean value.

b=>r=>[...b.map((n,i)=>n.repeat(+n&&3-i)).join``].sort()+''==[...r].sort()

Try it online!


#JavaScript (ES6), 74 bytes

Takes input as (gold, silver, bronze, 'rep'). Returns a Boolean value.

(g,s,b,r)=>(F=s=>[...s].sort()+0)(r)==F([g,g,g,s,s,b].filter(x=>x).join``)

Try it online!

Arnauld
  • 197.7k
  • 20
  • 179
  • 650