Skip to main content
added 1213 characters in body
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148

Vyxal, 3 bytes1 byte

Try it Online!

Same method as DLosc's 3 byte Pip answer. Takes a list of lists of either 0 or 1.

Simply computes 1 - n for each digit. Alternatively,

Vyxal, 3 bytes

₀S* 

Try it Online!

Takes a multiline string of 0s and 1s. The flag, header and footer are for allowing the test cases to be directly pasted in without having to change them.

Explained

₀S* ₀S # The string "10" * # Ring translate the input according to that - change 0 to 1, 1 to 0 and leave newlines as they are. 

Vyxal, 3 bytes

₀S* 

Try it Online!

Takes a multiline string of 0s and 1s. The flag, header and footer are for allowing the test cases to be directly pasted in without having to change them.

Explained

₀S* ₀S # The string "10" * # Ring translate the input according to that - change 0 to 1, 1 to 0 and leave newlines as they are. 

Vyxal, 1 byte

Try it Online!

Same method as DLosc's 3 byte Pip answer. Takes a list of lists of either 0 or 1.

Simply computes 1 - n for each digit. Alternatively,

Vyxal, 3 bytes

₀S* 

Try it Online!

Takes a multiline string of 0s and 1s. The flag, header and footer are for allowing the test cases to be directly pasted in without having to change them.

Explained

₀S* ₀S # The string "10" * # Ring translate the input according to that - change 0 to 1, 1 to 0 and leave newlines as they are. 
Source Link
lyxal
  • 35.6k
  • 2
  • 69
  • 148

Vyxal, 3 bytes

₀S* 

Try it Online!

Takes a multiline string of 0s and 1s. The flag, header and footer are for allowing the test cases to be directly pasted in without having to change them.

Explained

₀S* ₀S # The string "10" * # Ring translate the input according to that - change 0 to 1, 1 to 0 and leave newlines as they are.