Skip to main content
added 44 characters in body
Source Link
Veskah
  • 4.1k
  • 13
  • 29

PowerShell, 6966 69 bytes

-3 bytes thanks to mazzy

''+($args|%{"$_"*$i++*!!$_}|% t*y|sort)-eq''+eq(''+$args[0]|% t*y|sort)

Try it online!Try it online!

Takes input at (Rep, Bronze, Silver, Gold)

Figure I'll take a crack at my own question. Converts the numbers toCharArrays and sorts them. Appends an empty string so the sorted arrays are converted back to space-separated strings which can then be compared.

We handle 0 medal counts with !!$_ which doubly negates the number, making it go non-zero number-> 0 -> 1 or 0 -> 1 -> 0 which is used to blank the repeat counter.

PowerShell, 69 bytes

''+($args|%{"$_"*$i++*!!$_}|% t*y|sort)-eq''+(''+$args[0]|% t*y|sort)

Try it online!

Takes input at (Rep, Bronze, Silver, Gold)

Figure I'll take a crack at my own question. Converts the numbers toCharArrays and sorts them. Appends an empty string so the sorted arrays are converted back to space-separated strings which can then be compared.

We handle 0 medal counts with !!$_ which doubly negates the number, making it go non-zero number-> 0 -> 1 or 0 -> 1 -> 0 which is used to blank the repeat counter.

PowerShell, 66 69 bytes

-3 bytes thanks to mazzy

''+($args|%{"$_"*$i++*!!$_}|% t*y|sort)-eq(''+$args[0]|% t*y|sort)

Try it online!

Takes input at (Rep, Bronze, Silver, Gold)

Figure I'll take a crack at my own question. Converts the numbers toCharArrays and sorts them. Appends an empty string so the sorted arrays are converted back to space-separated strings which can then be compared.

We handle 0 medal counts with !!$_ which doubly negates the number, making it go non-zero number-> 0 -> 1 or 0 -> 1 -> 0 which is used to blank the repeat counter.

Source Link
Veskah
  • 4.1k
  • 13
  • 29

PowerShell, 69 bytes

''+($args|%{"$_"*$i++*!!$_}|% t*y|sort)-eq''+(''+$args[0]|% t*y|sort)

Try it online!

Takes input at (Rep, Bronze, Silver, Gold)

Figure I'll take a crack at my own question. Converts the numbers toCharArrays and sorts them. Appends an empty string so the sorted arrays are converted back to space-separated strings which can then be compared.

We handle 0 medal counts with !!$_ which doubly negates the number, making it go non-zero number-> 0 -> 1 or 0 -> 1 -> 0 which is used to blank the repeat counter.