g | x | w | all
Bytes Lang Time Link
003Japt250725T143852ZShaggy
008Uiua240810T035137ZErikDaPa
018Dyalog APL250724T235357ZAaron
045AWK250304T200032Zxrs
144Tcl181115T190649Zsergiol
008Vyxal 3240810T061022Zbb94
001UiuaSBCS240809T074029ZEurope20
001Thunno 2230816T102457ZThe Thon
045Knight220804T031928ZnaffetS
004Factor220615T060110Zchunes
053Python 3200918T041813Zlukekh
013Pip200912T062617ZRazetime
102APLNARS200103T090224Zuser5898
022Perl 5 MListUtil=max F200101T233719ZXcali
074Wren200101T141451Zuser8505
008Charcoal181115T200613ZNeil
039Retina 0.8.2181115T195353ZNeil
025Ruby181119T090906ZG B
057C# .NET Core181116T133045ZLiefdeWe
5599Ceylon181117T224704ZPaŭlo Eb
004Japt181116T182255ZOliver
057Java 10181116T084731ZKevin Cr
015Perl 6181116T023916ZJo King
020Python 2181115T151111ZErik the
001Jelly181115T145449ZErik the
125Twig181116T111421ZIsmael M
049JavaScript ES6181115T161523ZArnauld
002MATL181116T011744ZLuis Men
005Pyth181115T211338Zlirtosia
00505AB1E181115T152318ZRiley
120Batch181115T202118ZNeil
153SNOBOL4 CSNOBOL4181115T193317ZGiuseppe
037Perl 6181115T190314ZSean
005Stax181115T183806Zrecursiv
040Haskell181115T181536Zბიმო
065R181115T152019ZGiuseppe
007Japt181115T155006ZShaggy
012J181115T152120ZGalen Iv
005Husk181115T180300Zბიმო
056Python 2181115T144830ZTFeld

Japt, 3 bytes

I/O as digit arrays, with the input left padded with 0s.

íwV

Try it

Uiua, 14 8 bytes (thanks to nyxbird's suggestion)

⍜∩⊥₁₀⬚0↥

14 bytes version:

⋕/↥⬚⌞@ ⊟∩°⋕

Explanation:

⍜∩⊥₁₀⬚0↥
 ∩⊥₁₀    => convert to reversed list of digits
     ⬚0↥ => max between digits padded with 0s if needed
⍜        => then convert back into a number
⋕/↥⬚⌞@ ⊟∩°⋕
        ∩°⋕ => both numbers into strs
   ⬚⌞@ ⊟    => combine and pad 0s on the left
 /↥         => find max between digits (ascii-wise)
⋕           => finally parse

Clarification: Input is two integer numbers, not strings.

Try this online! (8 bytes version)

Try this online! (14 bytes version)

Desmos, 43 / 95 bytes

Input is 2 lists of digits with the short one being pre-padded with 0s.

f(X,Y)=[max(X[i],Y[i])fori=[1...length(X)]] => maximum between each digit

95 bytes version: (input is 2 lists of digits, w/out pre-padding)

a=length(X)                                            => redefinitions
b=length(Y)                                            
n(x)=\{x=x:x,0\}                                       => convert undef to 0
g(X,Y)=[max(n(X[a-i]),n(Y[b-i]))fori=[max(a,b)-1...0]] => maximum of each digit from the right-most digit

Try these online!

Dyalog APL, 18 chars

{10⊥⌈⌿⌽↑⌽¨⍎¨∘⍕¨⍺⍵}

Explanation:

{                 }
              ⍕       Format (turn to string)
             ∘          and (compose)
           ⍎¨           execute each character to turn into a vector of digits
               ¨      On each
                ⍺⍵      of the left and right args
         ⌽¨           Reverse both of them
       ⌽↑             Mix and reverse again; this was done so that the
                          mixing would append zeroes to the front if
                          one number is fewer characters than the other
     ⌈⌿               Find the max of each column
  10⊥                 And turn it into a base-10 number again 

AWK, 45 bytes

{for(;i++<y=NF/2;)printf($i>x=$(i+y+1))?$i:x}

Attempt This Online!

Tcl, 144 bytes

proc S a\ b {join [lmap x [split [format %0[set l [string le [expr max($a,$b)]]]d $a] ""] y [split [format %0$l\d $b] ""] {expr max($x,$y)}] ""}

Try it online!

Vyxal 3, 8 bytes

Assumes that the inputs are zero-padded.

Ṃ₉÷Tᵛ/G“

Try it Online!

UiuaSBCS, 1 byte

Try it here!

Input as two space-padded strings.

↥ maximum compares each pair of characters and puts the larger one in the new array.

Thunno 2, 1 byte

§

Try it online!

I/O as pre-padded lists of digits. Built-in for "dyadic maximum".

Knight, 45 bytes

;=aP;=bP Wa;O+A I>a bAaAb"\";=aGa 1La=bGb 1Lb

Try it online!

Takes two zero-padded numbers (it works with spaces as well).

Factor, 4 bytes

vmax

Try it online!

Python 3, 53 bytes

s=lambda p,q:p+q and 10*s(p//10,q//10)+max(p%10,q%10)

Pip, 13 bytes

{aGTb?ab}MZab

Maps zipped pairs of the two inputs and then returns the greater one.

Inputs must be padded with spaces.

Try it online!

APL(NARS), 51 chars, 102 bytes

{k←⌈/≢¨(a b)←⍎¨∘⍕¨⍺⍵⋄f←{((k-≢⍵)⍴0),⍵}⋄10⊥(f a)⌈f b}

test:

  h←{k←⌈/≢¨(a b)←⍎¨∘⍕¨⍺⍵⋄f←{((k-≢⍵)⍴0),⍵}⋄10⊥(f a)⌈f b}
  1999 h 2018
2999
  17210 h 701
17711
  32 h 17
37
  308 h 250
358
  308 h 25
328

Perl 5 -MList::Util=max -F, 22 bytes

say map{max $_,getc}@F

Try it online!

Input must be 0 or space padded so that the entries are the same length.

Wren, 74 bytes

Fn.new{|i|(0...i.count/2).map{|j|i[j]>i[j+i.count/2]?i[j]:i[j+i.count/2]}}

Try it online!

Input is a single list of the two operands, e.g.

[1, 7, 2, 1, 0,
 0, 0, 7, 0, 1]

Explanation

Now I need to figure out a formula for maximum.

Fn.new{|i|                                                               } // New anonymous function with the operand i
          (0...i.count/2)                                                  // Define an exclusive range from 0 to half the input
                         .map{|j|                                       }  // Turn every item of the list into ...
                                 i[j]>i[j+i.count/2]?i[j]:i[j+i.count/2]   // ... The maximum between i[j] and i[j+i.count/2]
                                                                           // (which is simply the other list's index at the same position)

Charcoal, 8 bytes

⭆θ⌈⟦ι§ηκ

Try it online! Link is to verbose version of code. Explanation:

 θ          First input
⭆           Map over characters and join
  ⌈         Maximum of
   ⟦        List of
    ι       Current character of first input and
      η     Second input
     §      Indexed by
       κ    Current index
            Implicitly print

10-byte version "adds" any number of padded strings:

⭆§θ⁰⌈Eθ§λκ

Try it online! Link is to verbose version of code. Previous 14-byte version accepts unpadded strings:

⭆◧θLη⌈⟦ι§◧ηLθκ

Try it online! Link is to verbose version of code. Explanation:

  θ             First input
 ◧              Padded to
   L            Length of
    η           Second input
⭆               Map over characters and join
     ⌈          Maximum of
      ⟦         List of
       ι        Current character of first input and
          η     Second input
         ◧      Padded to
           L    Length of
            θ   First input
        §       Indexed by
             κ  Current index
                Implicitly print

17-byte version "adds" any number of strings:

≔⌈EθLιη⭆η⌈Eθ§◧ληκ

Try it online! Link is to verbose version of code.

Retina 0.8.2, 39 bytes

+`^(.*)(.)¶(.*)(.)
$1¶$3¶$2$4
%O`.
¶.?

Try it online! Link includes test suite. Previous 45-byte Retina 1 version accepts unpadded strings:

P^`.+
+`^(.*)(.)¶(.*)(.)
$1¶$3¶$2$4
%O`.
¶.?

Try it online! Link includes test suite. Explanation:

P^`.+

Pad both values to the same length. (Retina 1 only. There are ways of emulating this in Retina 0.8.2 but they are not very golfy.)

+`^(.*)(.)¶(.*)(.)
$1¶$3¶$2$4

Transpose the values.

%O`.

Sort each pair into order.

¶.?

Delete all the low digits and surplus newlines.

Ruby, 25 bytes

->a,b{a.zip(b).map &:max}

Try it online!

Pre-padded list blah blah. (Although it feels a little like cheating.)

C# (.NET Core), 57 bytes

a=>b=>a.Select((x,i)=>a[i]>b[i]?x:b[i])

-1 bytes by adding currying

Try It Online

Ceylon, 55 / 99

With 0- or space-padded strings of same length (returning an iterable of characters):

function t(String a,String b)=>zipPairs(a,b).map(max);

With 0- or space-padded strings (returning a String):

String t(String a,String b)=>String(zipPairs(a,b).map(max));

With strings of possibly different length (returning a String):

String u(String a,String b)=>String(zipPairs(a.padLeading(b.size),b.padLeading(a.size)).map(max));

Japt, 4 bytes

Input is taken as a an array of two 0-padded number arrays.

y_rw

Try it online!

Java 10, 78 57 bytes

a->b->{for(int i=a.length;i-->0;)if(a[i]<b[i])a[i]=b[i];}

Input as two space-padded character arrays.

Modifies the first input-array instead of returning a new one to save 21 bytes (thanks to @OlivierGrégoire).

Try it online.

Explanation:

a->b->{            // Method with two char-array parameters and String return-type
  for(int i=a.length;i-->0;)
                   //  Loop `i` in the range (length, 0]:
    if(a[i]<b[i])  //   If the `i`'th character in input `a` is smaller than in input `b`:
      a[i]=b[i];}  //    Change the `i`'th character in `a` to the `i`'th character of `b`

Perl 6, 15 bytes

{[~] [Zmax] $_}

Try it online!

Takes input as a list of space padded arrays of characters, though for this challenge the lax input format makes it rather boring. Alternatively, here's the program that takes a list of two integers instead:

Perl 6, 41 bytes

{+[~] [Zmax] $_>>.fmt("%{.max}d")>>.comb}

Try it online!

If you don't mind a huge amount of whitespace, you can also remove the + from the front.

Explanation:

{                                       }  # Anonymous code block
             $_>>    # Map each integer to 
                 .fmt("%{.max}d") # The number padded by the max of the list spaces
                                 >>.comb   # And split each to list of characters
      [Zmax]  # Get the max of each digit at each index
              # This works because space is coerced to 0
              # Otherwise we would have to add a 0 to the formatting string
  [~]   # Join the list of digits and spaces
 +      # And coerce the string to a number to get rid of leading whitespace

Python 2, 20 bytes

lambda*a:map(max,*a)

Try it online!

I/O as 0-pre-padded lists of digits.

Jelly, 1 byte

»

Try it online!

I/O as 0-pre-padded lists of digits.

Twig, 125 bytes

When I saw this challenge, I though: "let me use a template language! sure is a good fit"

I was wrong ... so wrong .... ... But was fun!

{%macro a(a,b,s='')%}{%for k,x in a|reverse|split('')%}{%set s=max(x,(b|reverse|split('')[k]))~s%}{%endfor%}{{s}}{%endmacro%}

This requires that "strict_variables" is set to false (default value).

To use this macro, you can do like this:

{% import 'file.twig' as my_macro %}

{{ my_macro.a(195,67) }}

Should display 167.

You can try this in https://twigfiddle.com/rg0biy
("strict_variables" set to off, it is on by default on the website)

JavaScript (ES6), 51 49 bytes

NB: This answer was posted before the loose I/O formats were explicitly allowed. With zero-padded arrays of digits, this can be done in 33 bytes, (but is much less interesting, IMHO).

Takes input as two integers. Returns an integer.

f=(a,b,t=10)=>a|b&&(a%t<b%t?b:a)%t+t*f(a/t,b/t)|0

Try it online!

Commented

f = (                     // f = recursive function taking:
  a,                      //   a = first integer
  b,                      //   b = second integer
  t = 10                  //   t = 10 (which is used 6 times below)
) =>                      //
  a | b                   // bitwise OR between a and b to test whether at least one of
                          // them still has an integer part
  &&                      // if not, stop recursion; otherwise:
  (                       //
    a % t < b % t ? b : a // if a % 10 is less than b % 10: use b; otherwise: use a
  ) % t +                 // isolate the last decimal digit of the selected number
  t *                     // add 10 times the result of
  f(a / t, b / t)         // a recursive call with a / 10 and b / 10
  | 0                     // bitwise OR with 0 to isolate the integer part

Alternate version

Same I/O format.

f=(a,b)=>a|b&&[f(a/10,b/10)]+(a%10<b%10?b:a)%10|0

Try it online!

MATL, 2 bytes

X>

Choose the most appropriate format for your language/solution

The input format is: 2D char array of two rows, each corresponding to a line, with the shorter number left-padded with spaces. For example

17210
  701

which in MATL is defined as

['17210'; '  701']

Try it online!

Explanation

      % Implicit input: 2D char array with two rows 
X>    % Take maximum of (code points of) each column
      % Implicit display

Pyth, 5 bytes

meSdC

Takes input as array of two space-padded strings.

meSd       map greatest
    C      on the transpose of input

Try it here.

05AB1E, 9 6 5 bytes

-3 thanks to Emigna
-1 thanks to Shaggy

íζ€àR

Takes input as a list of lists of digits

í      # Reverse both inputs
 ζ     # Zip
  ۈ   # Keep the bigger digits
    R  # Reverse

Try it online! or Try all test cases

Batch, 120 bytes

@set/aw=1,x=%1,y=%2,z=0
@for /l %%i in (0,1,9)do @set/a"z+=w*((v=y%%10)+(v-=x%%10)*(v>>4)),y/=10,x/=10,w*=10
@echo %z%

Takes input as command-line parameters. 188-byte version works on arbitrary length integers:

@set/px=
@set/py=
@set z=
:l
@if %x:~-1% gtr %y:~-1% (set z=%x:~-1%%z%)else set z=%y:~-1%%z%
@set x=%x:~,-1%
@set y=%y:~,-1%
@if "%x%" neq "" if "%y%" neq "" goto l
@echo %x%%y%%z%

Takes input on STDIN.

SNOBOL4 (CSNOBOL4), 153 bytes

	X =INPUT
	Y =INPUT
	Y =DUPL(0,SIZE(X) - SIZE(Y)) Y
S	X LEN(1) . A REM . X	:F(O)
	Y LEN(1) . B REM . Y
	O =O GT(A,B) A	:S(S)
	O =O B	:(S)
O	OUTPUT =O
END

Try it online!

Perl 6, 37 bytes

{[R~] roundrobin($_».reverse)».max}

Try it online!

Takes input as a list of lists of digits.

Stax, 5 bytes

|>E:o

Run and debug it

This program takes input as an array of strings.

|>  Right align inputs (filling with \0)
E   "Explode" array onto stack separately
:o  "Overlay" Keep the maximum element respective element from two arrays.

Run this one

This is the first time I've seen a use for the overlay instruction "in the wild".

Haskell, 40 bytes

a#b=zipWith max(p b++a)$p a++b
p=(' '<$)

Input/output as strings, try it online!

Explanation

The function p replaces each character by a space, using p b++a and p a++b are thus the same length. This way we can use zipWith without losing any elements, using max with it works because a (space) has lower codepoint than any of the characters ['0'..'9'].

R, 68 65 bytes

function(x)apply(outer(x,10^(max(nchar(x)):1-1),`%/%`)%%10,2,max)

Try it online!

Input as integers, output as list of digits.

If zero-padding lists of digits was allowed, then simply pmax would suffice.

Japt, 9 8 7 bytes

Takes input as an array of digit arrays.

mÔÕÔËrw

Try it

m            :Map
 Ô           :  Reverse
  Õ          :Transpose
   Ô         :Reverse
    Ë        :Map
     r       :  Reduce by
      w      :  Maximum

If taking zero-padded arrays as input is permitted (it would currently fall under a "convenient format" but I suspect that's not the challenger's intent) then this can be 3 bytes.

íwV

Try it

í       :Interleave the first input
  V     :With the second
 w      :Reduce each pair by maximum

J, 14 12 bytes

-2 bytes thanks to Jonah

(>./@,:)&.|.

Try it online!

Input and output as list(s) of digits

Husk, 5 bytes

↔¤żY↔

Conveniently takes input/output as list of digits, try it online or verify all!

Explanation

↔¤żY↔  -- example inputs [1,4] [3,2]
 ¤  ↔  -- reverse the arguments of: [4,1] [2,3]
  żY   -- | zipWith (keeping elements of longer) max: [4,3]
↔      -- reverse: [3,4]

Python 2, 73 60 56 bytes

lambda a,b:map(max,zip(a.rjust(len(b)),b.rjust(len(a))))

Try it online!

Takes input as two strings, and returns a list of digits


Alternative:

Takes input as two integers; same output

Python 2, 60 59 bytes

lambda*i:map(max,zip(*['%*d'%(len(`max(i)`),v)for v in i]))

Try it online!