Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 28 characters in body
Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Retina, 85(削除) 85 (削除ここまで) 59 bytes

^'0P`.+
L$`\G(?<=(.)*).(?=.*¶(?<-1>N$`.)*(
$.))%`
$&2ドル
%
/../_(`^
$"$"
T`d`Rd`.¶.
%N`.
N`^N`..
)L`¶L`^.

Try it online! Try it online! Takes input as separate lines, but link is to test suite that reformats comma-separated input. Explanation:

^'0P`.+

Left-pad with zeros both lines to the same length.

L$`\G(?<=(.)*).(?=.*¶(?<-1>N$`.)*(
$.))%`
$&2ドル

TransposeSort each digit by its column index, then delete the inputsnewline. (This might not beThis has the besteffect of pairing the digits together in much the same way toas a transpose would.)

%/../_(`

Apply separately to each pair of digits, joining the results together.

^
$"

Duplicate the pair.

T`d`Rd`.¶.

Reverse the second digit of the first pair and the first digit of the second, so we now have x ~y on one line and ~x y on the other.

%N`.

Sort the digits of each line in order, so that the first digit is now x & ~y or ~x & y as appropriate.

N`^N`..

SortReverse sort the lines into order.

)L`¶L`^.

And extract the first digit of the second line, which is the desired result.

Remove a whole bunch of temporary newlines.

Retina, 85 bytes

^'0P`.+
L$`\G(?<=(.)*).(?=.*¶(?<-1>.)*(.))
$&2ドル
%(`^
$"
T`d`Rd`.¶.
%N`.
N`..
)L`¶.

Try it online! Takes input as separate lines, but link is to test suite that reformats comma-separated input. Explanation:

^'0P`.+

Left-pad with zeros both lines to the same length.

L$`\G(?<=(.)*).(?=.*¶(?<-1>.)*(.))
$&2ドル

Transpose the inputs. (This might not be the best way to transpose.)

%(`

Apply separately to each pair of digits.

^
$"

Duplicate the pair.

T`d`Rd`.¶.

Reverse the second digit of the first pair and the first digit of the second, so we now have x ~y on one line and ~x y on the other.

%N`.

Sort the digits of each line in order, so that the first digit is now x & ~y or ~x & y as appropriate.

N`..

Sort the lines into order.

)L`¶.

And extract the first digit of the second line, which is the desired result.

Remove a whole bunch of temporary newlines.

Retina, (削除) 85 (削除ここまで) 59 bytes

^'0P`.+
N$`.
$.%`


/../_(`^
$"
T`d`Rd`.¶.
%N`.
^N`..
L`^.

Try it online! Takes input as separate lines, but link is to test suite that reformats comma-separated input. Explanation:

^'0P`.+

Left-pad with zeros both lines to the same length.

N$`.
$.%`

Sort each digit by its column index, then delete the newline. This has the effect of pairing the digits together in much the same way as a transpose would.

/../_(`

Apply separately to each pair of digits, joining the results together.

^
$"

Duplicate the pair.

T`d`Rd`.¶.

Reverse the second digit of the first pair and the first digit of the second, so we now have x ~y on one line and ~x y on the other.

%N`.

Sort the digits of each line in order, so that the first digit is now x & ~y or ~x & y as appropriate.

^N`..

Reverse sort the lines.

L`^.

And extract the first digit, which is the desired result.

Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Retina, 85 bytes

^'0P`.+
L$`\G(?<=(.)*).(?=.*¶(?<-1>.)*(.))
$&2ドル
%(`^
$"
T`d`Rd`.¶.
%N`.
N`..
)L`¶.
¶

Try it online! Takes input as separate lines, but link is to test suite that reformats comma-separated input. Explanation:

^'0P`.+

Left-pad with zeros both lines to the same length.

L$`\G(?<=(.)*).(?=.*¶(?<-1>.)*(.))
$&2ドル

Transpose the inputs. (This might not be the best way to transpose.)

%(`

Apply separately to each pair of digits.

^
$"

Duplicate the pair.

T`d`Rd`.¶.

Reverse the second digit of the first pair and the first digit of the second, so we now have x ~y on one line and ~x y on the other.

%N`.

Sort the digits of each line in order, so that the first digit is now x & ~y or ~x & y as appropriate.

N`..

Sort the lines into order.

)L`¶.

And extract the first digit of the second line, which is the desired result.

Remove a whole bunch of temporary newlines.

AltStyle によって変換されたページ (->オリジナル) /