Skip to main content
Update MATL Online URL
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52

MATL, 64 58 57 50 46 40 37 36 35 30 bytes

O'!":<TUV '59-G)hYsIH$6#u64+c!

Try it at MATL OnlineMATL Online

Explanation

O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
i)          % Grab the input and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
IH$6#u      % Find the index of the last (sorted) occurrence of each location
64+         % Add 64 to this index to create ASCII codes
c!          % Convert to character, transpose, and display

MATL, 64 58 57 50 46 40 37 36 35 30 bytes

O'!":<TUV '59-G)hYsIH$6#u64+c!

Try it at MATL Online

Explanation

O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
i)          % Grab the input and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
IH$6#u      % Find the index of the last (sorted) occurrence of each location
64+         % Add 64 to this index to create ASCII codes
c!          % Convert to character, transpose, and display

MATL, 64 58 57 50 46 40 37 36 35 30 bytes

O'!":<TUV '59-G)hYsIH$6#u64+c!

Try it at MATL Online

Explanation

O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
i)          % Grab the input and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
IH$6#u      % Find the index of the last (sorted) occurrence of each location
64+         % Add 64 to this index to create ASCII codes
c!          % Convert to character, transpose, and display
deleted 253 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52

MATL, 64 58 57 50 46 40 37 36 35 30 bytes

O'!":<TUV '59-G)hYsIH$6#u64+c!

This version only works in MATLAB using release 19.7.2 since the behavior of unique is different between MATLAB and Octave.

Here is a slightly modified versionTry it at (35 bytes) that works in Octave and therefore works in the online interpreters

nQ:64+cPO'!":<TUV '59-G)hYsPHH$6#u)

Try it online!MATL Online

Explanation

O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
i)          % Grab the input and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
IH$6#u      % Find the index of the last (sorted) occurrence of each location
64+         % Add 64 to this index to create ASCII codes
c!          % Convert to character, transpose, and display

MATL, 64 58 57 50 46 40 37 36 35 30 bytes

O'!":<TUV '59-G)hYsIH$6#u64+c!

This version only works in MATLAB using release 19.7.2 since the behavior of unique is different between MATLAB and Octave.

Here is a slightly modified version (35 bytes) that works in Octave and therefore works in the online interpreters

nQ:64+cPO'!":<TUV '59-G)hYsPHH$6#u)

Try it online!

Explanation

O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
i)          % Grab the input and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
IH$6#u      % Find the index of the last (sorted) occurrence of each location
64+         % Add 64 to this index to create ASCII codes
c!          % Convert to character, transpose, and display

MATL, 64 58 57 50 46 40 37 36 35 30 bytes

O'!":<TUV '59-G)hYsIH$6#u64+c!

Try it at MATL Online

Explanation

O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
i)          % Grab the input and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
IH$6#u      % Find the index of the last (sorted) occurrence of each location
64+         % Add 64 to this index to create ASCII codes
c!          % Convert to character, transpose, and display
deleted 14 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52

MATL, 64 58 57 50 46 40 37 36 3535 30 bytes

O'!":<TUV '59-G)hYsIH$6#u64+c!

This version only works in MATLAB using release 19.7.2 since the behavior of unique is different between MATLAB and Octave.

Here is a slightly modified version (35 bytes) that works in Octave and therefore works in the online interpreters

nQ:64+cPO'!":<TUV '59-G)hYsPHH$6#u)

Try it online!

Explanation

            % Implicitly grab the input
nQ          % Determine the number of inputs and add 1 (N)
:           % Create an array from [1...N]
64+         % Add 64 (converts this to ASCII codes [65....65+N])
c           % Convert from ASCII codes to actual characters (['A'...Nth_letter])
P           % Reverse the string
O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
Gi)          % Grab the input again and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
PHH$6#uIH$6#u      % FlipFind the input andindex findof the firstlast (sorted) occurrence of each location
)  64+         % Use theAdd result64 to index intothis ourindex initialto (flipped)create characterASCII arraycodes
c!          % Convert %to Implicitlycharacter, displaytranspose, theand resultdisplay

MATL, 64 58 57 50 46 40 37 36 35 bytes

nQ:64+cPO'!":<TUV '59-G)hYsPHH$6#u)

Try it online!

Explanation

            % Implicitly grab the input
nQ          % Determine the number of inputs and add 1 (N)
:           % Create an array from [1...N]
64+         % Add 64 (converts this to ASCII codes [65....65+N])
c           % Convert from ASCII codes to actual characters (['A'...Nth_letter])
P           % Reverse the string
O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
G)          % Grab the input again and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
PHH$6#u     % Flip the input and find the first (sorted) occurrence of each location
)           % Use the result to index into our initial (flipped) character array
            % Implicitly display the result

MATL, 64 58 57 50 46 40 37 36 35 30 bytes

O'!":<TUV '59-G)hYsIH$6#u64+c!

This version only works in MATLAB using release 19.7.2 since the behavior of unique is different between MATLAB and Octave.

Here is a slightly modified version (35 bytes) that works in Octave and therefore works in the online interpreters

nQ:64+cPO'!":<TUV '59-G)hYsPHH$6#u)

Try it online!

Explanation

O           % Push the number 0 to the stack
'!":<TUV '  % String literal
59-         % Converts this string literal into [-26 -25 -1 1 25 26 27 -27]. These
            % are deltas for the linear indexes into the matrix corresponding to each
            % of the directions. Note that the -27 is at the end since a 0 index wraps
            % around to the end
i)          % Grab the input and use it to index into the delta array 
h           % Horizontally concatenate this with the 0 (our starting point)
Ys          % Take the cumulative sum to get the absolute linear index (location) of
            % each successive letter
IH$6#u      % Find the index of the last (sorted) occurrence of each location
64+         % Add 64 to this index to create ASCII codes
c!          % Convert to character, transpose, and display
deleted 172 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
added 1183 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
added 5 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
deleted 2 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
deleted 2 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
deleted 8 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
edited body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
added 3 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
added 5 characters in body
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading
Source Link
Suever
  • 11.2k
  • 1
  • 23
  • 52
Loading