Skip to main content
add ternary version
Source Link
640KB
  • 11.9k
  • 2
  • 35
  • 57

PHP, 92 79 bytes

fn($a)=>array_product(array_keys(array_intersect(array_count_values($a),[1])));

Try it online!

This isn't going to win for brevity, but just thought I'd try it entirely using chained PHP array functions.

Now using @Guillermo Phillips's suggestion for PHP 7.4 arrow function syntax to save 13 bytes.

PHP, 66 bytes

fn($a,$b,$c)=>$a-$c?$a-$b?$b-$c?$a*$b*$c:$a:$b==$c?:$c:$b==$c?:$b;

Try it online!

And another crazy ternary version inspired by @Guillermo Phillips's answer!

PHP, 92 79 bytes

fn($a)=>array_product(array_keys(array_intersect(array_count_values($a),[1])));

Try it online!

This isn't going to win for brevity, but just thought I'd try it entirely using chained PHP array functions.

Now using @Guillermo Phillips's suggestion for PHP 7.4 arrow function syntax to save 13 bytes.

PHP, 92 79 bytes

fn($a)=>array_product(array_keys(array_intersect(array_count_values($a),[1])));

Try it online!

This isn't going to win for brevity, but just thought I'd try it entirely using chained PHP array functions.

Now using @Guillermo Phillips's suggestion for PHP 7.4 arrow function syntax to save 13 bytes.

PHP, 66 bytes

fn($a,$b,$c)=>$a-$c?$a-$b?$b-$c?$a*$b*$c:$a:$b==$c?:$c:$b==$c?:$b;

Try it online!

And another crazy ternary version inspired by @Guillermo Phillips's answer!

-13 bytes, guess it's time to go ahead and use PHP 7.4
Source Link
640KB
  • 11.9k
  • 2
  • 35
  • 57

PHP, 9292 79 bytes

functionfn($a){return array_product=>array_product(array_keys(array_intersect(array_count_values($a),[1])));}

Try it online!Try it online!

This isn't going to win for brevity, but just thought I'd try it entirely using chained PHP array functions.

Now using @Guillermo Phillips's suggestion for PHP 7.4 arrow function syntax to save 13 bytes.

PHP, 92 bytes

function($a){return array_product(array_keys(array_intersect(array_count_values($a),[1])));}

Try it online!

This isn't going to win for brevity, but just thought I'd try it entirely using chained PHP array functions.

PHP, 92 79 bytes

fn($a)=>array_product(array_keys(array_intersect(array_count_values($a),[1])));

Try it online!

This isn't going to win for brevity, but just thought I'd try it entirely using chained PHP array functions.

Now using @Guillermo Phillips's suggestion for PHP 7.4 arrow function syntax to save 13 bytes.

Source Link
640KB
  • 11.9k
  • 2
  • 35
  • 57

PHP, 92 bytes

function($a){return array_product(array_keys(array_intersect(array_count_values($a),[1])));}

Try it online!

This isn't going to win for brevity, but just thought I'd try it entirely using chained PHP array functions.