Skip to main content
added 66 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, 11 10 99 8 bytes

Thanks to ETHproductions for 1 byte off!

"@X@qYS&h"@X@YS&h 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge']. The output strings are in reverse order.

Try it online!Try it online!

###Explanation

 % Input 2D array implicitly " % For each column of implicit input @ % Push current column X@ % Push iteration index, starting at 1 q  % Subtract 1 YS % Circularly shift the column by that amount &h % Concatenate horizontally with (concatenated) previous columns % End implicitly % Display implicitly 

##Old version: 9 bytes

tZyP:q1&YS1&YS 

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array as input % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] q % Subtract 1  % STACK: ['Halloween'; 'Challenge'], [0 1 2 3 4 5 6 7 8] 1&YS % Circularly shift each column by those amounts respectively % STACK: ['Hhlloeegn';'Caallwnee'][Caallwnee';'Hhlloeegn'] % Display implicitly 

MATL, 11 10 9 bytes

"@X@qYS&h 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge'].

Try it online!

###Explanation

" % For each column of implicit input @ % Push current column X@ % Push iteration index, starting at 1 q  % Subtract 1 YS % Circularly shift the column by that amount &h % Concatenate horizontally with (concatenated) previous columns % End implicitly % Display implicitly 

##Old version

tZyP:q1&YS 

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] q % Subtract 1  % STACK: ['Halloween'; 'Challenge'], [0 1 2 3 4 5 6 7 8] 1&YS % Circularly shift each column by those amounts respectively % STACK: ['Hhlloeegn';'Caallwnee'] % Display implicitly 

MATL, 11 10 9 8 bytes

Thanks to ETHproductions for 1 byte off!

"@X@YS&h 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge']. The output strings are in reverse order.

Try it online!

###Explanation

 % Input 2D array implicitly " % For each column @ % Push current column X@ % Push iteration index, starting at 1 YS % Circularly shift the column by that amount &h % Concatenate horizontally with (concatenated) previous columns % End implicitly % Display implicitly 

##Old version: 9 bytes

tZyP:1&YS 

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array as input % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] 1&YS % Circularly shift each column by those amounts respectively % STACK: [Caallwnee';'Hhlloeegn'] % Display implicitly 
added 47 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, 11 10 9 bytes

"@X@qYS&h 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge'].

Try it online!

###Explanation

" % For each column of implicit input @ % Push current column X@ % Push iteration index, starting at 1 q % Subtract 1 YS % Circularly shift the column by that amount &h % Concatenate horizontally with (concatenated) previous columns % End implicitly % Display implicitly 

##Old version

tZyP:q1&YS 

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] q % Subtract 1 % STACK: ['Halloween'; 'Challenge'], [0 1 2 3 4 5 6 7 8] 1&YS % Circularly shift each column by those amounts respectively % STACK: ['Hhlloeegn';'Caallwnee'] % Display implicitly 

MATL, 11 10 9 bytes

"@X@qYS&h 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge'].

Try it online!

###Explanation

" % For each column of implicit input @ % Push current column X@ % Push iteration index, starting at 1 q % Subtract 1 YS % Circularly shift the column by that amount &h % Concatenate horizontally with previous columns % End implicitly % Display implicitly 

##Old version

tZyP:q1&YS 

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] q % Subtract 1 % STACK: ['Halloween'; 'Challenge'], [0 1 2 3 4 5 6 7 8] 1&YS % Circularly shift each column by those amounts respectively % STACK: ['Hhlloeegn';'Caallwnee'] % Display implicitly 

MATL, 11 10 9 bytes

"@X@qYS&h 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge'].

Try it online!

###Explanation

" % For each column of implicit input @ % Push current column X@ % Push iteration index, starting at 1 q % Subtract 1 YS % Circularly shift the column by that amount &h % Concatenate horizontally with (concatenated) previous columns % End implicitly % Display implicitly 

##Old version

tZyP:q1&YS 

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] q % Subtract 1 % STACK: ['Halloween'; 'Challenge'], [0 1 2 3 4 5 6 7 8] 1&YS % Circularly shift each column by those amounts respectively % STACK: ['Hhlloeegn';'Caallwnee'] % Display implicitly 
added 47 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, 11 1010 9 bytes

tZyP:q1&YS"@X@qYS&h 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge'].

Try it online!Try it online!

###Explanation

" % For each column of implicit input @ % Push current column X@ % Push iteration index, starting at 1 q % Subtract 1 YS % Circularly shift the column by that amount &h % Concatenate horizontally with previous columns % End implicitly % Display implicitly 

##Old version

tZyP:q1&YS 

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] q % Subtract 1 % STACK: ['Halloween'; 'Challenge'], [0 1 2 3 4 5 6 7 8] 1&YS % Circularly shift each column by those amounts respectively % STACK: ['Hhlloeegn';'Caallwnee'] % Display implicitly 

MATL, 11 10 bytes

tZyP:q1&YS 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge'].

Try it online!

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] q % Subtract 1 % STACK: ['Halloween'; 'Challenge'], [0 1 2 3 4 5 6 7 8] 1&YS % Circularly shift each column by those amounts respectively % STACK: ['Hhlloeegn';'Caallwnee'] % Display implicitly 

MATL, 11 10 9 bytes

"@X@qYS&h 

Input is a 2D array containing the two strings, such as: ['Halloween'; 'Challenge'].

Try it online!

###Explanation

" % For each column of implicit input @ % Push current column X@ % Push iteration index, starting at 1 q % Subtract 1 YS % Circularly shift the column by that amount &h % Concatenate horizontally with previous columns % End implicitly % Display implicitly 

##Old version

tZyP:q1&YS 

###Explanation

 % Take input implicitly t % Duplicate % STACK: ['Halloween'; 'Challenge'], ['Halloween'; 'Challenge'] Zy % Size % STACK: ['Halloween'; 'Challenge'], [2 9] P % Flip array % STACK: ['Halloween'; 'Challenge'], [9 2] : % Range. Uses first element of the array % STACK: ['Halloween'; 'Challenge'], [1 2 3 4 5 6 7 8 9] q % Subtract 1 % STACK: ['Halloween'; 'Challenge'], [0 1 2 3 4 5 6 7 8] 1&YS % Circularly shift each column by those amounts respectively % STACK: ['Hhlloeegn';'Caallwnee'] % Display implicitly 
added 271 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading