Skip to main content
Commonmark migration
Source Link

#MATLAB, 60 bytes#

MATLAB, 60 bytes

@(y)[arrayfun(@(x)bin2dec([97-fliplr(dec2bin(x)) '']),y) ''] 

Basically each character in turn is converted into a binary string (with no leading zeros). The array is flipped and is subtracted from 97 ('0'+'1') which inverts the character. This is converted back to decimal. After all characters have been processed, the whole array is then converted back to characters before being returned.

#MATLAB, 60 bytes#

@(y)[arrayfun(@(x)bin2dec([97-fliplr(dec2bin(x)) '']),y) ''] 

Basically each character in turn is converted into a binary string (with no leading zeros). The array is flipped and is subtracted from 97 ('0'+'1') which inverts the character. This is converted back to decimal. After all characters have been processed, the whole array is then converted back to characters before being returned.

MATLAB, 60 bytes

@(y)[arrayfun(@(x)bin2dec([97-fliplr(dec2bin(x)) '']),y) ''] 

Basically each character in turn is converted into a binary string (with no leading zeros). The array is flipped and is subtracted from 97 ('0'+'1') which inverts the character. This is converted back to decimal. After all characters have been processed, the whole array is then converted back to characters before being returned.

Source Link
Tom Carpenter
  • 4.3k
  • 14
  • 21

#MATLAB, 60 bytes#

@(y)[arrayfun(@(x)bin2dec([97-fliplr(dec2bin(x)) '']),y) ''] 

Basically each character in turn is converted into a binary string (with no leading zeros). The array is flipped and is subtracted from 97 ('0'+'1') which inverts the character. This is converted back to decimal. After all characters have been processed, the whole array is then converted back to characters before being returned.